W3C home > Mailing lists > Public > www-style@w3.org > October 2006

Re: Mixing percentage height and min-height

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 13 Oct 2006 10:56:36 -0700
To: www-style@w3.org
Message-ID: <20061013175636.GA9274@ridley.dbaron.org>
On Friday 2006-10-13 16:47 +0000, Ian Hickson wrote:
> 
> On Fri, 13 Oct 2006, Boris Zbarsky wrote:
> > 
> > What if I have:
> > 
> >  .parent { height: 20px; min-height: 100px; }
> >  .child { height: 50% }
> > 
> > and the same markup?  Should the child end up 10px tall?  Or 50px tall?
> 
> 50px; the height is based on the height of the containing block which in 
> this case is 100px.

It's nowhere near that obvious, since 10.5 says [1]:

# <percentage>
#   [...] If the height of the containing block is not specified
#   explicitly (i.e., it depends on content height), and this
#   element is not absolutely positioned, the value computes to
#   'auto'.

The height of the containing block *does* in this case depend on the
content height -- if the content had been taller than 100px, it
would expand.

-David

[1] http://www.w3.org/TR/CSS21/visudet.html#the-height-property

-- 
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

Received on Friday, 13 October 2006 17:56:51 GMT

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