Resolving Browser Display Discrepancies Between IE and Firefox
July 17th, 2007 | Posted in Web Design, WordPress |
When you begin modifying your blog’s stylesheet or designing your own blog, you may notice that some elements display differently in Internet Explorer (IE) than they do in Firefox. IE is usually the problematic browser, and it’s hard to say why there are so many CSS display quirks and bugs from Microsoft. But there is a quick, easy fix around the troubling display discrepancies.
In short, you create two stylesheets, one for IE and one for Firefox and other browsers. You then add a piece of code in your header that tells to the IE browser to read the IE style sheet. The other browsers will read the other stylesheet.
To create separate stylesheets for the different browsers:
1. Duplicate your current stylesheet and change the name to something like ie7.css.
2. In your header file, locate the current call to your stylesheet. It should look something like this:
<style type="text/css" media="screen"> @import
url( <?php bloginfo('stylesheet_url'); ?> );
</style>
Delete this call to your style sheet.
3. In the place where you deleted the style sheet call, add this code instead:
<![if IE]><link rel="stylesheet" type="text/css"
href="http://blog.com/wp-content/themes/simpla/ie7.css">
<![endif]>
<![if !IE]><link rel="stylesheet" type="text/css"
href="http://blog.com/wp-content/themes/simpla/style.css">
<![endif]>
4. Customize the paths to your style sheets. The first code snippet says, if the browser is IE, use the ie7.css stylesheet. The second code snippet says, if the browser is not IE, use the style.css stylesheet.
With this method, you have two style sheets to maintain, so keep this in mind when making updates. However, you’ll be able to easily adjust the styles for the troublesome IE browser.
Additional Resources
- Creating Separate Stylesheets for Internet Explorer and Firefox. This site is where this tip comes from — thanks Kristen.
- Browser Specific Style for your WordPress Site. This article outlines a slightly different method that didn’t work for me, but it was still worthwhile.
- Firefox Web Developer Extension. The most useful CSS tool for adjusting your CSS.
- Internet Explorer Developer Toolbar. IE’s equivalent to the Firefox Developer extension. It’s not as user friendly and doesn’t work in exactly the same way, but it can also be useful.
Featured Information
People having access to internet are on the move because they can not only take Microsoft exams online but also get Microsoft certification while staying at home. Internet too makes possible running an online business like affiliate marketing or provides access to apply for the affiliation of affiliate programs. People having internet connections can get business web hosting or ask their hosting provider to increase or change their web hosting bandwidth while staying at home. The wireless internet provider has revolutionized these convenient facilities of internet and enabled the people to enjoy these facilities regardless of place and position.
Related Posts
- Firefox and Deepest Sender are superior to IE7
- Web Developer Firefox Extension Makes CSS Editing Easy
- Skype Firefox Exention Changes Phone Numbers into Buttons
- Are Gerunds in Topic Titles Problematic in Search Results?
- New WordPress Plugin Enables One-Click Installation of Plugins and Themes
Podcast in iTunes
Follow me on Twitter

July 20th, 2007 at 12:56 am
So I’m checking out my backlinks…
Thanks for linking to my site. Glad you found something useful.
I love your blog.
July 21st, 2007 at 5:45 am
Another handy extension for checking various aspects in IE is the Web Accessibility Toolbar, available for free from here: http://www.visionaustralia.org.au/info.aspx?page=614
July 21st, 2007 at 9:24 pm
Thanks for the tip, Rhonda.
July 22nd, 2007 at 10:13 am
Weekly Roundup - Week Ending June 20, 2007…
…
August 2nd, 2007 at 11:00 am
Your article states “The other browsers will read the OTHER stylesheet.” This is not quite so.
I experimented with two spreadsheets that contained simple styling - different colours for H1 and P elements. To the first (IE)stylesheet, I added another line: BODY { background-color: gray; }
In the non-IE browser,I saw a grey background! I expected the usual white background.
What happens is that a non-IE browser cannot under the IF lines so it runs BOTH stylesheets, one after the other.
To make this feature work, both stylesheets must define each style. For example, if one stylesheet defines the format of an H2, the other one must too.
August 2nd, 2007 at 12:57 pm
Ahhh, good point. I’ve always defined the format for the same selectors on each stylesheet, so I’ve never had the non-IE browser pick up any property values for the IE selectors. I think I’ll play with that a bit and update my article with the new results. Thanks.
September 10th, 2007 at 7:48 am
[...] displays between IE and Firefox Tom Johnson has put together a good series of tips on matching browser displays between Internet Explorer and Firefox. Although the two browsers are more standards-compliant then in the past, web designers who need to [...]
January 22nd, 2008 at 3:28 pm
[...] Resolving Browser Display Discrepancies Between IE and Firefox This is where the site tip comes from - Thanks Tom! [...]
April 26th, 2008 at 11:50 am
very nicely done.
Thx,
David
April 26th, 2008 at 11:50 am
very nicely done,
Thx,
David
May 23rd, 2008 at 3:25 pm
I have tried to change my layout, and unsuccessfully it behaves the same. So the workaround in the mean time is to click on the item menu or use Internet Explorer
Some people have reported differences between firefox and internet explorer [Resolving Browser Display Discrepancies Between IE and Firefox
July 25th, 2008 at 10:21 pm
Hi David,
Thanks for the useful post you have here.
However, I learned by accident that the change in code can not be done since some of the symbols shown on your site has been modified. Here are what I found:
Old code on header:
<link rel=”stylesheet” href=”" type=”text/css” media=”screen” />
Change to
XXX is the name of the site.
YYY is the theme you use.
You may want to edit the code so that it can be useful to others. Anyway, I appreciate the contents on your site.
Cheers,
Jim Somchai,
Jim Somchais last blog post..How To Fix WordPress Blog That Shows Differently on IE and Firefox
July 25th, 2008 at 10:24 pm
Sorry, some words are missing. I didn’t know how to edit my comments.
Change the code to:
Jim Somchais last blog post..How To Fix WordPress Blog That Shows Differently on IE and Firefox
July 25th, 2008 at 10:28 pm
The codes are not show on the comments. This may be why your post on the code is different. Let me get the last short.
Change to:
****
**************
*****
**************
I hope it works this time. Just take stars out.
Jim Somchais last blog post..How To Fix WordPress Blog That Shows Differently on IE and Firefox