Andi Smith on February 12th, 2008

Thanks to the way older versions of Internet Explorer browsers render particular HTML elements, often it’s not possible to supply the same CSS stylesheet to every browser.

Thankfully, Internet Explorer supports conditional comments, and is the only browser to do so, which allows us to specify special CSS stylesheets for different versions of Internet Explorer, from version 5 upwards.

Internet Explorer / Firefox Toilets

Conditional comments are structured in the same way as HTML comments, meaning browsers other than Internet Explorer will just treat them as comments, while IE has special code which looks for the conditions’ syntax within comments. They can only be placed in HTML files and are written in the format:

<!--[if expression]> HTML <![endif]-->

Click to continue reading “Conditional Comments”

Continue reading about Conditional Comments