7

Generally, what's the best way to tackle a layout bug in IE6? What are the most common bugs or problems that one should look for when trying to figure out why your page suddenly looks like a monkey coded it?

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
Jason Wadsworth
  • 933
  • 1
  • 10
  • 18

12 Answers12

9

First Things First

Get yourself the Internet Explorer Developer Toolbar. It's a life saver and works great with IE6 and/or IE7. It's no replacement for Web Developer Toolbar or Firebug for Firefox, but it's better than nothing.

Know Thy Enemy

Read up on the quirks of IE — particularly hasLayout and overflow and the like. There are also many CSS niceties that you'll have to either do without or find alternatives. Look into how many of the popular JavaScript toolkits/frameworks/libraries get around different issues.

Rome Wasn't Built in a Day

The more you have to work with it, the more you'll remember off hand and won't have to lookup as often. There's just no replacement for experience in this. As several have pointed out, though, there are great resources out there on the net. Position Is Everything is certainly up there.

Sean Hanley
  • 5,677
  • 7
  • 42
  • 53
4

http://www.positioniseverything.net/ will certainly address your problem.

It provides comprehensive and in-depth descriptions of browser bugs along with options to work around them. A must read, in my opinion,

petr k.
  • 8,040
  • 7
  • 41
  • 52
  • also it's nice that is discusses not only IE-specific bugs, but also those found in Opera and other browsers. – petr k. Sep 17 '08 at 14:43
2

One good way to start learning about how IE happens to be mangling the page is to turn on red borders on different elements with CSS (border: 1px solid red;). This will immediately tell you whether it's a margin problem or a padding problem, how wide the element really is, etc.

Alex King
  • 2,504
  • 23
  • 26
1

Noticed that Marc's post is at a -2 =D. He's only saying "resort to tables" even though they blow, because in sucky browsers like IE6, some of the broken CSS commands work in tables only (who know's why... dam you Bill Gates!!!). Here's a good reference to see what works and doesn't work as far as CSS goes. http://www.quirksmode.org/css/contents.html . It's a great reference to check on what cool effects work/don't work with various, widely used browsers. Also, always have a go-to plan for users who browse with IE6 (even though it's just about as old as mechanical dirt) as many businesses still use older browsers (including non-profits/3rd world countries etc.) So by all means, create the bugged out drop-down menu that looks WAY better than a standard horizontal menu, but create a secondary one specifically for IE6 that becomes the default when the page receives a request from an IE6 browser.

Mechaflash
  • 11
  • 1
1

The box model is usually the culprit. Basically what this means is that any div you are trying to position and use unsupported CSS with will cause this problem.

You may find it happens if you are using min-{width,height} or max-{width,height}.

this provides a great reference for checking compadibility with different versions.

http://www.aptana.com/reference/html/api/CSS.index.html

Nick Berardi
  • 54,393
  • 15
  • 113
  • 135
  • The box model is hardly ever the culprit. For some reason, people have latched onto the phrase "box model" and use it as a magical talisman to explain everything wrong with Internet Explorer. It does *not* mean "unsupported CSS on a div". The major problems are caused by bugs, see Yadyn's answer. – Jim Sep 17 '08 at 14:44
  • Jim, it actually is the box model. You may not like the word, but it is the best word used to describe the problems. What else do you call it when IE 6 treats the total size of the box differently than other browsers? – Nick Berardi Sep 18 '08 at 13:23
  • Also it is very hard to say it is a bug, bug means something was coded wrong, I don't believe that is the case, Microsoft has been very consistent in keeping their layout, "box model" the same. – Nick Berardi Sep 18 '08 at 13:26
0

how do you define layout bug? the most frustrating layout implementation (i don't know if this should be defined as bug) in IE is we need to always specify style="display:inline" in the HTML <form> tag so that a blank line won't appear to disturb the form layout.

0

This question I believe has far too much scope.

Validate your code, and if pain persists, well, good luck.

The only real solutions, as with any other ballpark bug type are to google for a solution, or ask somebody who knows, ( ie: give the exact problem to us here at stackoverflow ).

You can use the IE Dev toolbar to glean an Idea, but many of the bugs are random, inexplicable, and esoteric. IE: the guillotine bug, the random item duplication bug, etc etc, the list goes on, and you can spend hours literally goofing with stupid variables everywhere and achieve nothing.

Kent Fredric
  • 56,416
  • 14
  • 107
  • 150
0

I have a simple strategy that works every time.

First, I develop the site using commonly accepted CSS to look good in Safari and Firefox 3. See w3schools.com for details on browser support.

Then, I go into IE6 and IE7 and alter the CSS using conditional includes.

This is hack free and lets you handle different browsers (IE6 and IE7 have separate issues).

Most of the issues you'll find come from unsupported features in IE (like min-width), errors in the box model (IE adds unseen extra padding (3px) to some boxes), or positioning issues. Go for those first as they are often the issue.

Matt Farina
  • 597
  • 4
  • 12
0

A common problem is padding not getting added to the width of a block element. So for layout div's, avoid using padding and instead use elements within them to define the padding.

Chris James
  • 11,571
  • 11
  • 61
  • 89
0

I use Rafel Lima's Browser Selector when I need to tweak differences between IE/Standards browsers. It greatly reduces using "hacks" in your HTML to solve common problems.

You can target CSS statements for different browsers, or even different versions of browsers (Hello IE 6). It's very simple to implement, but requires the user has JavaScript turned on (most do).

.thing { ....}

.ie .thing { ....}

.ie6 .thing { ....}

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
-1

We had a floating div issue that was only evident in a particular version of IE6. It was fixed by downloading the latest service pack.

Simon Keep
  • 9,886
  • 9
  • 63
  • 78
  • Um...that's not a fix. That only hides the problem on your computer...it will still show up for anyone else that doesn't have that service pack. – Beska Feb 13 '09 at 16:48
  • Yes Beska you are right of course, my point was more that this is still something to be aware of when investigating these kind of bugs. – Simon Keep Oct 21 '10 at 09:32
-3

In theory, use CSS compatible with IE6 layout bugs, utilise only well known workarounds (css and html filters) and code for them in a way that wont break forward compatibility, test for quirks/strict mode.

In reality, resort to tables.

Marc Gear
  • 2,757
  • 1
  • 20
  • 19