Conditional Comments Fix IE Bugs

As pointed out in some earlier comments, there’s a great way to fix IE bugs without hacks or relying on one browser bug to solve another one. I present to you conditional comments.

<!--[if IE 6]><link rel="stylesheet" href="stylesheets/ie6.css" type="text/css" media="all" /><![endif]-->

Yes, you read that correctly. If the browser is IE6, apply these styles. It’s that simple.

Other browsers will just pass this aside as a regular HTML comment, but the IE browsers will recognize the “if” statement and apply your fixes! And as a bonus, it validates! There’s many more ways to configure this that’ll make life easier, so I’ll pass on these links to you. Enjoy, and happy bug-squashing!

P.S. This may also be a good use for conditional comments with IE6:

<!--[if IE 6]>Why on Earth are you still using IE6? <a href="http://getfirefox.com">Get Firefox today!</a><![endif]-->

2 Trackbacks

  1. […] CSS for lunch Skip to content About « Conditional Comments Fix IE Bugs […]

  2. By fszsrocw on November 19, 2008 at 4:20 am

    fszsrocw…

    fszsrocw…

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
vpn service