Monday, December 10th, 2007

Fixing the IE Double Margin Bug

One rather annoying aspect of Internet Explorer is the way that it mishandles a number of stylesheet commands. Most of these are corrected by placing a valid doctype statement as the first entry in your page source as IE also misuses that statement to determine whether to use “satandards” mode or “quirks” mode in interpreting the stylesheet. In quirks mode IE does completely its own thing interpreting the stylesheet almost completely differently from what the commands are supposed to mean. In standards mode it handles most things correctly (apart from a huge slew of stylesheet commands that IE7 and earlier don’t understand (and which IE9 probably wont either).

One of the things that it does sort of understand but which it still gets wrong is when you float an element to the side of the page and that element has a margin defined for that side. IE stupidly doubles the size of that margin resulting in the element ending up twice as far from that edge as it is supposed to be. Fortunately by adding an additional property to the stylesheet that makes absolutely no sense to have on the element at all but which does no harm in proper web browsers we are able to fix this error.

Fixing the IE Double Margin Bug

Share and Enjoy:
  • Digg
  • del.icio.us
  • Furl
  • description
  • StumbleUpon

Tags: , , , ,

Leave a Reply