Following the herd
Tuesday, 25. October 2005, 15:42:23
In the recent version 9 preview Opera is finally following the herd of browsers that default to margin instead of padding to inset body content.
It was inevitable, given that IE, the Mozilla browsers, Safari, etc all do it that way.
It's also sad, because it's objectively wrong - padding is the only correct answer to insetting body content while keeping the body background out to the edges of the canvas. The reason is that in CSS margin is always transparent, so using it should allow the default (usually white or gray) background colour to show all around the edges of the body which is not what page authors usually want. Padding takes on the background properties of the element, so it is the correct answer.
The reason margin "works" is because browser developers have had to implement nasty special case hacks for the <body> element, and the W3C has had to document nasty special case hacks for the CSS spec to allow that. I really wish the W3C had had the guts to make a stand and say "sorry guys, margin is wrong, use padding".
So, how did IE and Mozilla get to be using margin anyway? Before CSS web pages were styled using HTML tags like <b>, <i> and various attributes, such as "border" on tables. To indent <body>, IE supported the attributes "leftmargin" and "topmargin", while Mozilla supported "marginwidth" and "marginheight". Note that common term "margin". When the CSS spec came along, it also had a margin property, and the IE and Mozilla guys defaulted to using that, without noticing that CSS margin doesn't perform the same function as those attributes.
So now we have a situation where we have ugly hacks in browsers and specs - but only for HTML. XHTML pages have no exemption - they will have to use padding instead of margin for the same effect, or style <html> with the background style that used to be on <body>.
Unless, I suppose, that enough people bitch and moan about "bugs in browsers not handling margin properly" to force browsers and the W3C to mangle their respective products yet again.
That's what worries me the most. I'm probably worrying about nothing, but here we have a situation where the standard bearers are happy to capitulate to the wants of the masses, no matter how wrong that may be. I can't think of anything similar that exists right now, but if it's happened once, it could happen again. What's the point of standards then?
It was inevitable, given that IE, the Mozilla browsers, Safari, etc all do it that way.
It's also sad, because it's objectively wrong - padding is the only correct answer to insetting body content while keeping the body background out to the edges of the canvas. The reason is that in CSS margin is always transparent, so using it should allow the default (usually white or gray) background colour to show all around the edges of the body which is not what page authors usually want. Padding takes on the background properties of the element, so it is the correct answer.
The reason margin "works" is because browser developers have had to implement nasty special case hacks for the <body> element, and the W3C has had to document nasty special case hacks for the CSS spec to allow that. I really wish the W3C had had the guts to make a stand and say "sorry guys, margin is wrong, use padding".
So, how did IE and Mozilla get to be using margin anyway? Before CSS web pages were styled using HTML tags like <b>, <i> and various attributes, such as "border" on tables. To indent <body>, IE supported the attributes "leftmargin" and "topmargin", while Mozilla supported "marginwidth" and "marginheight". Note that common term "margin". When the CSS spec came along, it also had a margin property, and the IE and Mozilla guys defaulted to using that, without noticing that CSS margin doesn't perform the same function as those attributes.
So now we have a situation where we have ugly hacks in browsers and specs - but only for HTML. XHTML pages have no exemption - they will have to use padding instead of margin for the same effect, or style <html> with the background style that used to be on <body>.
Unless, I suppose, that enough people bitch and moan about "bugs in browsers not handling margin properly" to force browsers and the W3C to mangle their respective products yet again.
That's what worries me the most. I'm probably worrying about nothing, but here we have a situation where the standard bearers are happy to capitulate to the wants of the masses, no matter how wrong that may be. I can't think of anything similar that exists right now, but if it's happened once, it could happen again. What's the point of standards then?








