Click to See Complete Forum and Search --> : ie fix


keithhulse
08-03-2008, 12:59 PM
Hi, I am creating a php page and using css to format it. I want to use the ie hack:

<!--[if IE]>
<style>

</style>
<![endif]-->

to provide compatibility for multiple browsers.

Is there any reason this will not work. I can't seem to get it to work at present.

Many thanks,
Keith Hulse

rsmith
08-03-2008, 01:13 PM
I use this heavily in my projects to fix IE's inferiority. Here's what I do.

<!--[if IE6]>
<style type="text/css">
@import url("/css/ie6.css");
</style>
<![endif]-->

<!--[if IE7]>
<style type="text/css">
@import url("/css/ie7.css");
</style>
<![endif]-->


By using the @import you can keep all your hacks in separate css files and just include them into your page. Make sure the code snippet is in your <head> </head> tags