Create 2 stylesheets (IE & Firefox) in Wordpress

by webgarden ~ January 22nd, 2008. Filed under: Web Design.

It took me a couple of tries but I finally figured out how to create two stylesheets using wordpress.

  1. Duplicate style.css 
  2. Rename the copy to ie7.css (or whatever you would like to call it)
  3. Go to the Header Page of your theme.
  4. Find this code:
    <style type=”text/css” media=”screen”> @import
    url (<?php bloginfo(’stylesheet_url’); ?>);
    </style>
  5. delete this and replace with:
    <![if IE]><link rel=”stylesheet” type=”text/css”
    href=”http://blog.com/wp-content/themes/simpla/ie.css” mce_href=”http://blog.com/wp-content/themes/simpla/ie.css”>
    <![endif]>  
  6. <![if !IE]><link rel=”stylesheet” type=”text/css”
    href=”http://blog.com/wp-content/themes/simpla/style.css” mce_href=”http://blog.com/wp-content/themes/simpla/style.css”>
    <![endif]>

Basically this says that if the browser is IE user the ie.css stylesheet. If the browser is not IE then use the style.css stylesheet. Although you will now have two stylesheets to maintain, it is a lot easier to adjust the styles for troublesome IE.

Resolving Browser Display Discrepancies Between IE and Firefox This is where the site tip comes from – Thanks Tom!

1 Response to Create 2 stylesheets (IE & Firefox) in Wordpress

  1. John

    Great site and useful content! Could you leave some opinion about my sites?
    My site
    [url=http://ownsite.com/b/]My site[/url]
    http://ownsite.com/p/ My site

Leave a Reply