0

IE Conditional Comments

IE Conditional Comments via @largestartist Posted by Jose Cuadra on February 26, 2009 Tags: | | | Filed Under: References

Years ago before I discovered Internet Explorer’s Conditional Comments, I struggled with CSS hacks, IE filters, and unreliable JavaScript sniffers.
With this technique markup inside the comments will be only visible to the IE browser in general or specific versions that you specify.

To target Internet Explorer in general, singling it out from every other browser, you would use:

<!--[If IE]>
Some content here.
<![endif]-->

To target a specific version of IE, you would use:

<!--[If IE 7]>
Some content here.
<![endif]-->

To target versions of the browser that are 7 and below:

<!--[If lte IE 7]>
Some content here.
<![endif]-->

To target versions of the browser that are 6 and above:

<!--[If gte IE 6]>
Some content here.
<![endif]-->

Want More? Try These.

Related Articles
CFCACHE, IE, CSS and XHTML
Live Markup Editor
Flash Slideshow in Actionscript 3
Web Fonts Suck!
Type Doc Re-Released
Flash Display Fixes
Target Blank for XHTML
Table Behavior without Tables
Random Articles
CFCACHE, IE, CSS and XHTML
5 Pointz by Passetti
Dreamweaver CS3 Start and Crash Bug
Transversing the Display List Correctly
Twitter Highlights of the Week
IE Conditional Comments
JavaScripted Tooltips
Twitter Highlights of the Week
Pencil Painting with Nickelsen
Color Picker

Leave a Reply