Create CSS Conditional Stylesheet for IE in WordPress
To create a CSS conditional style sheet statements for Internet Explorer in WordPress using a child theme or master theme.
1) Copy the header.php to your child theme
2) Edit the file and go to a spot after the link tags – here you are going to insert an Internet Explorer conditional statement using a script tag – the script tag should be similar to this:
<!--[if gt IE 7]> <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/ie89.css" media="screen" type="text/css" /> <![endif]-->
This php call in the href is crucial in making the script work -it points to the child theme and in this instance I am targeting versions of IE greater than 7 and am naming the CSS file in the root of my child theme - ie89.css
In the actual CSS file you only need to declare what additional CSS styles you are targeting for IE as the original CSS style sheet for the WordPress theme is honoured.
You can make different CSS styles for various IE versions.
For a clear understanding of the IE script syntax Chris Coyler has a thorough definition of how it works.
You will also likely find that a parent theme already has IE conditional style sheets already set up – check the header.php for the script tag and where the CSS file path is – if this is the case simply locate the CSS file and add in your IE style rules.
Related posts:


October 26, 2011 










