Previous Message
Next Message

Re: [css-d] Re: How to get 100% height column?

Sent by Eric A. Meyer on 26 February 2002 19:07


At 15:49 -0800 2/26/02, James Aylard quoted and wrote:

>>  This thread in particular:
>>  http://lists.w3.org/Archives/Public/www-style/2001Oct/0107.html
>>
>>  I believe that this is the origin of the problem maybe:
>>  http://www.w3.org/TR/REC-CSS2/visuren.html#containing-block
>
>     But IMO these references don't validate the claim about not being able
>to set a height of 100%. So I assume that the assertion is incorrect, and
>that while there are caveats, there is no problem setting a height of 100%
>on block-level elements, at least.

    I'll do my best to shed some light on the subject (and hopefully 
not throw gasoline on the fire).  You can always, always, always give 
a block-level element a 'height' of '100%'.  This value will make the 
element's content height exactly as tall as its containing block-- 
which means if you add padding, borders, or margins to the element it 
will be taller than its containing block.
    Where things gets fuzzy is in the definition of a containing block 
for an element that doesn't have any positioned ancestors.  In such a 
case, the containing block is the root element.  The root element is 
not necessarily coincident with the browser window, so just setting a 
table (for example) to have 'height: 100%' doesn't guarantee that it 
will be as tall as the browser window[1].  I think that was the point 
of the original question that started this thread.
    We can argue about what the root element's containing block is or 
isn't until the cows turn purple, as other have done before us.  Some 
think it should be the browser window.  Others think it should be the 
'body' element, which is not the same as the browser window.  Still 
others claim it should be the 'html' element, which may or may not be 
the same as the browser window.  If you go to CSS2:10.1, you see 
this: "1. The containing block (called the initial containing block) 
in which the root element lives is chosen by the user agent."
    Which basically means user agents (browsers) get to do what they 
want in this regard, and there is no One Right Answer.  Unfortunately.


[1] Which might be a good thing, in the case of a table with more 
content than the browser window can display at once.

--
Eric A. Meyer (http://www.meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
   -- Martina Kosloff (http://www.mako4css.com/)
Previous Message
Next Message

Message thread:

Possibly related: