Conditional Comments

Apr 27

Conditional Comments

About Conditional Comments: A handy but pretty obscure feature of Internet Explorer. A special comment format lets only IE see certain HTML / CSS code. So make that Web page look good in Mozilla and Opera, then hide the code necessary for IE in these comments.

Conditional comments have certain advantages over scripting methods of browser detection. When a downlevel browser encounters a downlevel-hidden conditional comment, the browser does not see the inner HTML inside the comment, and the content elements are not downloaded and rendered. This saves both bandwidth and machine resources.

I had never heard of this until Joe showed it to me one day. It’s kludge, sure, but it’s endorsed kludge and it really is handy.


Comments

by Joost de Valk,   April 5, 2007 2:17 PM  

They're pretty darn handy to use, i've written an article on conditional comments to make it easier, especially with IE7 being around now.


by inder,   May 12, 2008 12:31 AM  

HTML CODE REQ. if that word is clicked only then show the link IN SAME WEB PAGE ANY TYPE OF IN HTML OR OTHER WHICH WORKS LIKA DESCRIBEDABOVE PLZ REPLY TO my_passion48@yahoo.com THANK IN ADVANCE!!!!!!!!!!!!!



Add Comment