I was working on some site design and needed to tweak it for IE (IE dev team, hello, is this thing on? Better CSS support please) in order to make look more along the lines of what I had intended (which is the way that FireFox and Safari display it). So off to Google I went hoping to find some way to easy include CSS only for IE browsers. Low and behold it is amazingly easy! I first came across this example which lead me to the conditional comments site. All I can say is, wow! It works, it’s simple, doesn’t feel like a complete crazy hack (although some might say the mere fact that this has to be done at all is a hack) and it only took me a minute or two to put it all together.
It is a shame that this has to be done, but at least there is an easy way to do it. Here’s an example of including CSS that will only be used by Internet Explorer (IE):
<!--[if IE]>
<link rel="stylesheet" type="text/css" media="screen"
href="/ie-style.css" />
<![endif]-->
It seems that you could include any sort of HTML (or JavaScript?) between these conditional comments.
2 replies on “IE Specific CSS”
Found this via your ping. Indeed it’s a nice feature.
I’d like to also point out the underscore hack, which can be easier to use because it works inline in the CSS.
Yes the underscore hack IS easier… but it’s not valid CSS… This is valid if i’m not wrong..