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

Re: Mixing percentage height and min-height

From: Allan Sandfeld Jensen <kde@carewolf.com>
Date: Thu, 12 Oct 2006 09:43:12 +0200
To: www-style@w3.org
Message-Id: <200610120943.12978.kde@carewolf.com>

On Thursday 12 October 2006 01:47, Ian Hickson wrote:
> On Wed, 11 Oct 2006, Allan Sandfeld Jensen wrote:
> > Just got an interesting "bug" in KDE bugzilla.
> >
> > You have:
> >
> > div { min-height: 100% }
> >
> > and two nested divs
> > <body>
> > <div><div> </div></div>
> > </body>
> >
> > The result is that inner div is not 100% of body.
>
> In the case given above, since the <body> does not have an explicit
> height, 'min-height: 100%' on its <div> child is exactly equivalent to
> 'min-height: 0'.
>

One of the solutions I considered for something like this (because it is 
un-intuitive right now) was to let percentages of min-height and max-height 
be calculated from min-height or max-height of the containing block if height 
is auto. So height is never calculated from min-max but min-max  are. 

So:

.parent { min-height: 100px }
.child { min-height: 50%; height: 50% }

Would calculate to .child { min-height: 50px; height: auto }


`Allan
Received on Thursday, 12 October 2006 07:43:42 GMT

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