skip to main content

TAMU Webmaster's Blog

Information and insight from the A&M Webmasters

Microsoft to the Rescue

September 23rd, 2008 by Erick Beck

Yes, that’s right, Redmond has actually done something positive for us. They have rescued us from themselves. As web developers we instinctively cringe whenever discussion turns to how to handle coding for Internet Explorer browsers. Which version do you mean? We still don’t know exactly how IE8 will handle our CSS code, IE7 is buggy but generally acceptable, IE6 is just bad, and if anybody is still running a version earlier than that — they have bigger problems than not being able to see my website as I intended it to look.

These differences have historically been resolved through CSS hacks — the box model hack, the Holly hack, and many others. But Microsoft themselves has given us a better way — IE Conditional Comments. These are specially formatted comment statements that other browsers will see and treat as comments but which IE will recognize as conditional “if” blocks. This, then, allows me to create one pristine CSS file for my entire site without any hacks, and to then include targeted styles in a second CSS file that will overwrite the original style with the code necessary for that particular browser version. For example:

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="/includes/css/ie6Fixes.css" />
< ![endif]-->

I know many of you already know about and use these statements on an everyday basis, but if you are not familiar with the technology please give it a chance, it can make your life much easier.

Tuesday, September 23rd, 2008 HTML
Share this article

No comments yet.

Leave a comment