29. november 2004 - 22:06
#4
sørg også for at din doctype er det første i dit dokument. altså ikke noget mellemrum først.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
Ellers vil IE ikke acceptere at det er et xhtml dokukument og den skal overholde reglerne
29. november 2004 - 22:16
#11
Minder vist lidt om det her:
This may be a difficult concept, but it serves useful purposes, so just accept it. At this stage, we have not lost IE. No, it gets this right up to here. But now lets start making a mess. With IE, if you apply a width to the empty paragraph (usually unintentionally while applying it to all paragraphs), it decides that you want to give it some height too. So it makes it big enough to contain one line of text. Not only does this one line of extra height now get added to the space, but the collapsing is all wrong. So the gap grows to max(10,30) + max(40,20) + line-height, so 40 pixels becomes more like 90. And before you try to use the height style to make it smaller, IE will ignore you. It will still make it one line-height tall, because of its incorrect overflow:visible; handling.
In response, the web developer applies some negative margins or relative positioning, without really knowing what they are doing or why, until the gap returns to normal in IE, about 40 pixels. (This assumes that IE does not decide to cut off the content where a negative margin pushes it over the bounds of its original position.) Of course, this has a very bad effect in the other browsers, as they correctly apply the 40 pixels, plus the negative 50 that was applied for IE, meaning the contents of the two paragraphs now overlap by 10 pixels. Definitely not the intended effect. This is a bit of an extreme example, but the effect is the same, even if a normal margin (or the browser's default margin) is applied to the paragraphs.