W3C home > Mailing lists > Public > www-style@w3.org > January 1998

Re: MSIE 4.0 and element boxes

From: David Perrell <davidp@earthlink.net>
Date: Wed, 7 Jan 1998 02:21:14 -0800
Message-ID: <001801bd1b55$fc6835e0$8a1cd9cf@davidp>
To: <www-style@w3.org>
Eric A. Meyer wrote:


>If you have MSIE 4.0 final for either Mac or Win95, try this:
>
>   <P style="border-right: double red 10px;">
>   This is a paragraph.
>   </P>
>
>On my Mac, the border appears all the way at the right edge of the browser
>window.  Similarly, if you use the following:
>
>   <P style="background-color: red;">
>   This is a paragraph.
>   </P>
>
>...the red box will span the entire width of the browser window.

It spans the width between the margins of BODY, and BODY typically has
default margins. It should only span the _entire_ width of the browser
window if the left and right margins, padding, and borders of all
ancestors--and the left and right margins and borders of itself--are set to
zero.

The width of a block element isn't determined by the width of its textual
content. Rather, the maximum width of the textual content is determined by
the width of the block element, and the width of the block element is the
width of its parent less any margins, borders, and padding.

>   This is just plain wrong, isn't it?  I mean, I read the specification to
>say that the default padding on each side of an element box should be zero,
>but MSIE seems to be generating something like 'auto' (not that such a
>value is permitted for any padding property), or perhaps assumes that
>elements default to 'width: 100%;' instead of 'auto'.

What you're missing is that a block element must fill the width of its
parent. In the case of your example, that's the width of the browser window
minus the left and right margins on BODY.

>  Editor, WebReview's Style Sheets Reference Guide

Uh oh. That's scary. Have you ever looked at the test pages at

   http://www.w3.org/Style/CSS/Test/

? Check out the 'box' page. Note, however, that the text incorrectly says
there should be a 2-pixel border around the paragraphs. Although a
border-width has been declared, a border-style has not, therefore the
border-style defaults to 'none', and it appears to me that IE4.01 is
rendering this page correctly, or very close to it.

David Perrell
Received on Wednesday, 7 January 1998 05:21:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:54 GMT