You are here: Re: div tag help « HTML « IT news, forums, messages
Re: div tag help

Posted by Ben C on 09/28/07 09:03

On 2007-09-25, rf <rf@invalid.com> wrote:
[...]
> Further, what exactly is the "page"?

There is the viewport, and the dimensions of the root element. If the
latter is bigger than the former, the browser gives you scrollbars.

The root element what most people mean by the "page".

Actually you can prevent the scrollbars if you really want to by an
obscure incantation that effectively sets overflow on the viewport:

UAs must apply the 'overflow' property set on the root element to the
viewport. HTML UAs must instead apply the 'overflow' property from
the BODY element to the viewport, if the value on the HTML element is
'visible'. The 'visible' value when used for the viewport must be
interpreted as 'auto'. The element from which the value is propagated
must have a used value for 'overflow' of 'visible'.

What all that means is that if you set overflow:visible on HTML and
overflow:hidden on BODY then you should get overflow:hidden on the
viewport and not be able to scroll to things that don't fit in it. I'm
sure that'll come in useful one day.

You can even supposedly make the viewport overflow:visible, but it does
say that might not work (depending on the "native operating
environment").

> Usually, with a really simple HTML file, it is the end of that HTML file.
> The bottom of the "content". Where the browser stops scrolling when one
> leans on ones page down button, because said browser can't go down any more.
> There is nothing further. Therebelow lie dragons.
>
> However if one distrupts the usual content flow by introducing floated
> elements or <shudder> absolutely positioned elements </shudder> then one
> totally loses the concept of the "page".

The root element ("page") is a block formatting context so grows in
height to fit the floats in.

> Where is the bottom of the "page" for a floated element? The bottom of the
> element? The bottom of the surrounding content?

Whichever's lower.

> Where is the bottom of the "page" for an absolutely positioned div
> element?

Now here things do get a bit fishy. The root element grows in size to
the bounding box of all the absolutely positioned things as well. I
don't know where/if that's specified.

> Where is the bottom of the "page" for an absolutely positioned div element
> where top: 1000px; has been specified? (try it and see, you will need to
> scroll down). Indeed if that element is the only one in the body of the
> HTML file where is the "top" of the "page"? Pixel 0 or pixel 1000?

Pixel 0 is the top, Pixel 1000 + height of the div is the bottom. +/-1
here and there.

> Hint: We don't actually know.
>
> The best we can guess is that, after the browser has done its best to lay
> out the content, after due consideration to these floated and positioned
> elements, the bottom of the page is where there is nothing more.

I think that's right. Note that the left and right edges of the root
element can also get pushed out by absolutely positioned elements.

[...]
> In any case HTML files do not describe "pages". They describe content, with
> CSS to pretty that content. The browser lays out the elements containing the
> content as it sees fit, with the CSS taken into account. Why should we ask
> more? "Page" is for print, not web.

OK, but "root element" = "page" pretty much.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация