Re: Width of an absolute positioned element

On 7/22/03 10:56 AM, "Christoph A. Mueller" <chris@christophm.de> wrote:

> 
> Hi,
> I have a question about the correct width of an absolute positioned element.
> 
> I have the following document:
> ------
> ...
> <body>
> <div style="position:absolute; left:0; top:0; width:100%">text</div>
> </body>
> ...
> ------
> 
> The width of the div element is defined as 100%.
> 
> But the width of the div element is different in Mozilla 1.4, Opera 7.11 and
> IE 6. Mozilla draws the div element from the left window border to the right
> window border. But in Opera and IE, 100% is only the content edge of the
> body element. Thus the window width minus the margin, padding and border.
> If I set the margin and padding of the body to zero, Opera and IE draw the
> div element from the left window border to the right window border too.
> 
> But I would like to know, which browser behaviour is defined in the css
> standard?

This is actually under quite a bit of debate in the CSS working group
currently, as there were numerous bugs in the way positioning was specified
in CSS2, and the working group is working diligently to fix them in CSS2.1.

One question for you though - is your document valid (and using a strict
DOCTYPE)?  It *may* make a difference in how the various browsers render it,
and from the perspective of the standard, we are interested in specifying
how valid documents should render.

Thanks,

Tantek

Received on Tuesday, 22 July 2003 14:17:58 UTC