Take the 2-minute tour ×

I am aware that there are probably other questions regarding this topic. I guess that every web developer goes through this with IE.

My problem:

I am developing a web-based application fully based on Javascript. I am a Mac user. I was really happy that everything worked great in Safari, Firefox and Opera. I then asked a friend with Windows to check it with Internet Explorer, and things don't work as well. My application is very sensitive to the HTML standards.

The main problem is the CSS layout. The JavaScript itself seems to be working properly thanks to jQuery for portability.

My question:

How do you deal with Internet Explorer? Should I create a new CSS that is only loaded on Internet Explorer? Should I create a new version of the application only for Internet Explorer? How do you normally handle this? The application is pretty big both in feature design and in layout design.


Using the CSS reset as suggested by Nosredna, already removed almost half of the problems. I guess it really is a good practice. I noticed that SO also uses it.

share|improve this question
My general technique involves a lot of swearing. –  CookieOfFortune May 29 '09 at 19:10
No offence, but shouldn't you have thought about IE when you started developing the app? It is after all still the browser with the largest marketshare. –  Tom van Enckevort May 29 '09 at 19:10
I deal with IE by using Firefox. =) –  gnovice May 29 '09 at 19:14
If your site is "heavy on the HTML" and "everything is ruined" in IE, then you wrote your website wrong. Simple really is better. –  Randolpho May 29 '09 at 19:20
@randolpho, It really is easy to make a mess if you ignore any of the major browsers (especially IE) along the way. RIAs heavy on AJAX need continual testing on all the browsers as they are developed. And leaving IE in quirks mode means you're working with two different box models. –  Nosredna May 29 '09 at 19:37
show 4 more comments

20 Answers

up vote 56 down vote accepted

Do you specify a valid doctype? You can get Internet Explorer to be a bit more compliant by switching it into standards mode. http://msdn.microsoft.com/en-us/library/bb250395.aspx#cssenhancements_topic2

Do you use a browser reset CSS file? That can help bring the versions together. http://meyerweb.com/eric/tools/css/reset/

Be aware of IE's CSS bugs: http://www.positioniseverything.net/explorer.html

For the skeleton of your layout, consider using markup that is known to work, such as http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts or http://960.gs/ for liquid or fixed layouts, respectively.

Keep up with JavaScript differences between browsers. jQuery handles some of them, but not all of them. http://www.impressivewebs.com/7-javascript-differences-between-firefox-ie/

Yeah, IE is a pain. If you want it to work in IE, you really want to test in IE every couple days. You don't want to save the pain for the end--you want to handle the nightmares one at a time.

By the way, if you think IE is a pain, try looking at your page with a mobile phone. The other day I went to REI.com with an iPhone and the middle fifth or more of the screen was taken up by a bunch of garbled markup that rendered as text.

share|improve this answer
Sry but, what is a browser reset CSS file? and which doctype do you sugest for IE to be more into the standards? –  fmsf May 29 '09 at 19:30
doctype info: msdn.microsoft.com/en-us/library/… one css reset (there are many): meyerweb.com/eric/tools/css/reset –  Nosredna May 29 '09 at 19:33
+1 for the browser reset file. –  John Gietzen May 29 '09 at 19:54
you're near getting the correct answer soon :) ty, just checking if more answers pop up –  fmsf May 29 '09 at 19:57
add comment

Conditional comments.

<!--[if IE 6]>
<!--[if IE 7]>
<!--[if IE 8]>
<!--[if !IE]-->

In the IE files, you can use @import to import normal.css, and then override the styles as necessary.

share|improve this answer
It would probably be faster for load times to simply link the normal.css first and for everywhere, and then below it the conditional comments for other browsers, overriding as necessary. –  Kzqai Oct 17 '09 at 4:51
add comment

First and foremost, I don't wait until the project is done to consider browser compatibility.

Most of the time for CSS issues there are ways to do things that don't require browser-specific stylesheets to be loaded, so I try to use those solutions wherever possible. For example - if most of your issues are related to box model problems, things like using nested divs in place of padding can help to make sure everything looks correct without the need for separate stylesheets and templates for different browsers.

share|improve this answer
add comment

Browser reset to start. Level the playing field as much as possible and do away with browser defaults. Build your CSS from the ground up. (See: http://meyerweb.com/eric/thoughts/2007/04/12/reset-styles/)

Test early and often across all major browsers during development.

Try to accomplish as much as possible without browser specific hacks. Sometimes you'll need to work in some browser-specific CSS but it should validate (use the W3C Validation tool). Sometimes though there's just nothing for it but a conditional (and maybe even some JavaScript), e.g. fix for transparent PNGs in IE6 (See: http://nettuts.com/videos/screencasts/5-easy-ways-to-tackle-ie6s-transparency-issues/).

If you cannot run IE on one of your development machines, try http://browsershots.org. At least you can get some feedback this way.

Use a debug.css that highlights or outlines divs and other elements. Toss this into your HTML head if needed during development. This can be a huge help.

Use "developer toolbars" where available (IE, Firefox).


Have fun!

share|improve this answer
great webpage that browsershots.org –  fmsf May 29 '09 at 19:35
Interesting remark... domain for link in answer was absorbed? Try clicking on it now XD Though, what can one expect in 4 years? However, I would still update/remove just in case, because I was just one other person who stumbled across this question and decided to start clicking around. –  Chris Cirefice Oct 8 '13 at 0:05
Removed link now defunct. Thanks Chris Cirefice. –  Thelonious Oct 10 '13 at 11:53
add comment

Here is how I try to reduce the pain of dealing with IE:

  1. Use a reset.css - Yahoo! YUI Reset or Eric Meyer's Reset CSS
  2. Be careful with floats, clears - they typically cause a lot of cursing.
  3. Be aware of hasLayout bugs in IE, typically adding a zoom: 1 or height attributes helps fix this. Read On Having Layout.
  4. Get the layout working in Firefox, Safari, Chrome, etc while keeping IE about 80% of the way there.
  5. Implement a IE6.css style and an IE7.css style if needed using conditional comments.
  6. Beer, Liquor or other adult beverages.
share|improve this answer
Is "On Having Layout" still valid in IE8? –  John Saunders May 29 '09 at 21:43
not sure how many bugs still exist in IE8 with hasLayout, but it certainly still sets the property on 40-60% of the page content in IE8 in standards mode. –  scunliffe May 30 '09 at 0:17
+1 for drinks!! –  Andrei Rînea Jan 16 '11 at 13:45
add comment

First, read On Having Layout, which explains how the IE rendering engine works internally. IE's rendering engine is from before CSS. It doesn't properly distinguish between inline and block elements like you'd expect. Instead, in IE an element hasLayout. Or not. This is the source of 99% of IE CSS bugs. So, read that article a couple of times.

As for fixes, I usually use conditional comments. Several reasons:

  • They are future proof, as opposed to CSS hacks. What if IE9 fixes the hack but not the bug you're using it to solve?
  • It's valid (X)HTML (conditional comments are just plain comments to everyone else)
  • It doesn't require javascript. You'd be amazed how many people have javascript turned off.

One remark about conditional comments: Never use an open ended match. That is, never do something like:

<!--[if IE]> <load css> <![endif]-->
<!--[if gte IE 7]> <load css> <![endif]-->

The reason is the same as hacks: make it future proof. What if the next version of IE fixes the bug and you don't need the fixes anymore? Or worse, the "fix" now actually messes up your layout in the new IE version? It's usually best to assume that the next version of IE has fixed the bug that you are working around. I have written a little bit about that back when IE 8 was on the horizon.

share|improve this answer
add comment

I think it would be okay to write a specific css file for IE. I know it is a pain, but because of some possitioning issues, IE6 looks different than all other browswers.

Use this line for your newly created css file:

<!--[if ie6]><link rel="stylesheet" type="text/css" media="screen" href="ie6_style.css" /><![endif]-->
share|improve this answer
add comment

With IE getting around 65% of the traffic, I don't think you can think of it as an after-thought.

share|improve this answer
The problem is that so many web developers use Macs or Linux. If Microsoft had IE for Mac & Linux, I think sites would look better on IE. –  Nosredna May 29 '09 at 19:41
add comment

Overall, I try to do as much as I can without making a separate CSS file for IE. I'll use come conditional formatting to target it specifically if needed. Overall though, at most you might need to do an IE only stylesheet to get it to work.

Just be sure that you are testing with the proper versions of IE for your audience, as IE 6, 7, and 8 are quite sommon.

share|improve this answer
add comment

As a last resort, when tweaking the CSS just won't fix things, I like to use Rafael Lima's CSS selector script. While it depends on JavaScript (most sites I build do anyway), it provides a convenient way to tweak CSS for different browsers and versions without separate stylesheets.

You can have :

.someClass {

.ie6.someclass {
share|improve this answer
add comment
  if (internetExplorer) {
    window.location = "http://getfirefox.com";
share|improve this answer
That's great! I should put that on all my websites that I develop! Though I think I would suggest Chrome now :-( –  JoshFinnie May 29 '09 at 19:33
Before suggesting Chrome you would need to check machine type as well. It's not available for the Mac and Linux users among us. Yet... –  John Munsch May 29 '09 at 19:50
@John Munsch... wouldn't the test for IE fail if the user was running on Mac/Linux? ;-) –  scunliffe May 30 '09 at 0:18
add comment

Keep the markup as simple as possible. Make small changes. Test every change.

share|improve this answer
add comment

I delete it

share|improve this answer
Shame on two people for upvoting this answer. –  belgariontheking May 29 '09 at 19:57
LOL, you'd better believe I thought it even though I didn't write it. –  John Munsch May 30 '09 at 3:27
Now 5 of you fools have upvoted this. Shame on you. –  belgariontheking Jun 1 '09 at 12:14
Agreed that it shouldn't be upvoted, but it shouldn't be downvoted as well! It's humor people... yes... that thing that makes you laugh ;-) –  fretje Jun 19 '09 at 13:20
I just want to point out that I'm the answerer and I'm mocking people for upvoting this. It has been a social experiment and the results exceeded my wildest expectations. –  belgariontheking Jun 19 '09 at 15:31
show 1 more comment

I would think that developing a new CSS File for use in IE would be considerably easier then re-writing your application, but I don't know what scale and scope your application has that would even render doing that a considerable option. I guess it can depend on what versions of IE you're looking to support.

We're at a point now that most users should have completely migrated away from IE6. IE7 is still a hassle, but nowhere near as bad as 6 was. With my projects, the default setup I sell is IE7 compatibility with code to direct users of IE6 and below to upgrade. If a client wants me to incorporate IE6 compatibility into a site, I typically increase the quoted price by 50% because of how awful of a headache is is to support the browser and how much extra visual code has to be written to make it work.

share|improve this answer
"Should have"... yes. In practice, I find that at least a quarter of IE traffic still comes from crusty old IE6. At least we seem to have finally gotten rid of IE5.5... –  phenry May 29 '09 at 19:57
That's what support is for ;). I've lost a few contracts with this stipulation, but not enough for me to consider changing my stance. I'd prefer to encourage users to get with the times then to allow them to continue to harbor old habits; but I find I'm in a bit of a minority with this mindset. –  KRC May 29 '09 at 20:07
We all want to leave IE6 behind (if not all IE versions). I like your solution of a 50% tax on developing for IE6. –  Nosredna May 29 '09 at 20:52
add comment

I know that this may fall into the 'too little, too late' category. That said, I would investing in VMWare or Parallels and create a Windows VM w/ IE6.

As you are developing, you should incrementally check your progress in the browsers that you care about.

That said, with an existing application, I would first make sure that my HTML was valid (there are a variety of validation services at your disposal) then, depending on the layout, I was section-by-section try to get the layout right, using comments to 'hide' the sections that you are not actively working on.

share|improve this answer
Plus, microsoft provides free images for multiple web browsers, XP with IE 6, XP with IE 8, XP with IE 7, Vista with IE 8, etc. Images here: microsoft.com/Downloads/… Or just search for IE App Compatibility Images runs on Ubuntu in VirtualBox after some driver finangling. –  Kzqai Oct 17 '09 at 5:14
add comment

I usually do everything I can to avoid having to create a separate CSS file. There are a lot of CSS & HTML tricks & tips out there that should allow you to make it work in IE6 & up, as well as every other common browser. It just takes time to figure it all out. Unfortunately, sometimes with complicated layouts it can take a lot of time especially when you don't test it as you go.

share|improve this answer
add comment

I let others solve the problems for me. I use Yahoo's excellent CSS files included in their YUI library. They have one file to remove existing formatting for existing labels (e.g. H1 in IE does not look like H1 in Firefox), they have another to give me a default set of formatting that does look the same across browsers, they have yet another to standardize font sizes, and most important of all of them is their grid file. It gives me the ability to build hierarchical formatting of regions and sub-regions on the page very quickly and easily and I know it will work on any major modern browser (Yahoo tests the heck out of it to make sure it does).

It may not be the perfect solution, but it has been more than sufficient for my needs.

share|improve this answer
add comment

I had the same issue in my dev: IE6, FFetc + LAMP + custom MVC, based on Rasmus Lerdorf's article way back when he suggested noMVC-kind of like handle it using includes for headers, footers and the sort. I coded CSS, got stuck with FF not rendering it nicely. I had to go revise my CSS knowledge - I found that a single CSS implementation can render correctly in std. compliant mode(FF) and IE6. I liked that. I was happy with handling any changes using a single CSS file. My advice:

  1. I know you have a Mac, go garage sale-ing (newspapers will tell you where they are), get an old PC for $10 (so far I've found plenty). This'll give you an opportunity to test out IE6 early, while you're at it get a KVM switch as well to access the machine when you need to.
  2. One of the things I've gotten addicted to is IE6's setting - Disable all ActiveX scripts - makes browsing the web without ads a blast, anyways - test out your app with & without activeX settings, and see how well your site does. This has literally saved me hours of 'painful' moments folks above me have mentioned prior.
  3. You prolly know how to test out FF/Opera/Safari with&without scripting
  4. Finally - regardless of how heavy Javascripting your site uses, make sure without scripting the core features (which I'm sure you have lot's of) load properly.

I'm no expert, but sure hope my comments help you out a bit.


share|improve this answer
add comment

I make sure my websites work natively and perfectly in ie9 , and work in ie8(possibly with features missing). I prompt everyone that uses an older version to get chrome frame. I never waste my time for ie7 and older, because using a 6 year old browser is pathetic, and should not be encouraged.

share|improve this answer
add comment

As nosredna said, use a valid doctype (see http://www.alistapart.com/articles/doctype/) Then check your web site in the w3c validator (http://validator.w3.org/). If it shows no errors (or just a few), then IE should render it correctly.

I wouldn't put much effort in making it compatible with IE6, and just accept the fact that a website can look different in various browsers.

share|improve this answer
You still have to put the effort in to make sure it's usable in different browsers though and properly validating markup is no guarantee in IE... –  Ben Thurley Jan 8 '13 at 16:22
add comment

Your Answer


