Benjamin Tinker Team : Web Development

Could IE finally be coming to the CSS party?

Benjamin Tinker Team : Web Development

One thing I crave for in programming is one piece of code that can cover as much ground as possible across as many platforms and interfaces as possible. Today there are so many different platforms and interfaces you have to account for in web development. There is the browser to take into account. Are they using Firefox, Chrome, Internet Explorer, Safari or some yet unheard of browser claiming to be the latest and greatest? What version of browser are they using and is it something worth while supporting? Then throw into the mix multiple viewing devices from the desktop PC to many different tablets and smart phones out there and you're in for a whole world of hurt trying to find one set of code that works on all these possible mediums.

Internet Explorer (known to us all as IE) is the bane of many a developer and has been for a long time with is DOM rendering and CSS compatibility. There were always chills when you were informed that the your new fancy website had to be compatible with IE 7 or the dreaded IE 6. Not just compatible but fully functional. Well, straight away you can throw out consistency in layouts as IE never fully supported the range that other browsers such as Firefox and Chrome did in the day. Yet IE did have a work around in the form of 'Conditional Comments'. A Conditional Comment was something recognised by IE alone that allowed you to insert snippets of HTML and CSS that only IE would include. A simple method would be like the one below:

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="css/ie.css" />
<![endif]-->
 
Here we are checking if the browser is IE and if so include the listed style sheet file. Using this type of Conditional Comment you could target the users particular version of IE and insert special CSS and Javascript content necessary for the users version of IE. It provided a way for developers to compensate for the short falls of IE.

Well, that's all changed as of IE 10. As of IE 10 Conditional Comments are now ignored by IE and treated as comments. The above Conditional Comment is ignored and parsed as a normal comment. No more IE specific CSS or Javascript content can be included. The IE Dev Centre website has the glorious details here. What does this mean? Hopefully it is a good thing as IE 10+ has decided to comply with HTML5 standards that are becoming more locked in to the developer community each day. One can hope that IE gets it right and comes to the CSS party that other browsers have been at for the past 3 years.

Yet there is a downside to IE moving away from Conditional Comments in respect to legacy sites. If the developer put code into their IE specific code that is necessary for the site to work in IE they may have to check it all works with IE 10+ and the non IE specific content. But who really cares about anything before IE 10 anyway? It's rhetorical.

Let's hope IE get it right this time and as developers we can use IE for more than checking if it can simply load a site. Who knows, with the right compatibility with everything else people may use that Bing thing of theirs too. Let's not get carried away just yet.