Adding a conditional stylesheet in Zen
Conditional stylesheets are a frequent requirement to accommodate hacks and workarounds specific to versions of the Internet Explorer browser. While other themes would require us to conditionally introduce said stylesheets either using a module or by inserting the appropriate HTML directly in the page.tpl.php
template, Zen-based themes offer a straightforward alternative.
In this recipe, we will be looking at the procedure involved in adding a conditional stylesheet which is loaded only if the browser is Internet Explorer (IE). Furthermore, the version of the browser has to be 7 (IE7) or greater.
Getting ready
This recipe centers around the myzen sub-theme which is assumed to have been created, enabled and set as the default theme. A CSS file named ie7.css
should be created and saved inside myzen's css
folder. Hacks and workarounds particular to IE7 are to be added to this file.
How to do it...
Adding a conditional stylesheet to the myzen theme can be accomplished...