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

Re: Mixing percentage height and min-height

From: Jonathan Watt <jwatt@jwatt.org>
Date: Mon, 16 Oct 2006 00:29:59 +0200
Message-ID: <4532B667.3040000@jwatt.org>
To: Ian Hickson <ian@hixie.ch>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, www-style@w3.org

Ian Hickson wrote:
> On Fri, 13 Oct 2006, Boris Zbarsky wrote:
>> One more question about percentage heights and min-height.  So if I have:
>> 
>>  .parent { min-height: 100px; }
>>  .child { height: 50% }
>> 
>> and
>> 
>>   <div class="parent"><div class="child"/></div>
>> 
>> then the child's computed height will be "auto" and the child will end up
>> 0px tall while the parent ends up 100px tall, right? That seems to be the
>> conclusion of the preceding discussion.
>> 
>> 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.

I'm coming at this from having had one of my Mozilla bugs closed as invalid 
after the discussion and clarification in this thread. I don't mean this mail as 
an insult or personal attack on anyone, but just to give my outsider view on 
something that frustrates me.

Speaking as an end user for now, it seems nuts to me that to get the percentage 
height on my child to come from the parents height when set through min-height I 
need to specify an extra and seemingly bogus |height:0;| on the parent. I don't 
see how the average CSS user could possibly guess that, and how anyone other 
than a CSS spec geek would think it makes sense. If there are good technical 
reasons to make this the behavior I can only assume you recognize this and tried 
to avoid it, but if not, please do try to figure out a way. XHTML is not the 
only post-HTML spec to be difficult and frustrating to use it seems.

Best regards,
Jonathan
Received on Sunday, 15 October 2006 22:30:04 GMT

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