Having a problem in Firefox, with something similar to:
<div style="border: thin solid blue; min-height: 15em;">
<div style="border: thin solid red; height: 80%;"></div>
</div>
I was expecting the outer div to have a height of 15em, with ability to
expand if needed, and the inner div to be 80% of its container.
Instead, the inner div appears to stretch the outer div to 80% of the screen
size.
If I change the min-height to height, it appears as planned, but will not
grow when content is added.
Any suggestions as to what is going on, or alternatives?
Thanks!
Jonathan N. Little - 24 Aug 2007 19:04 GMT
> Having a problem in Firefox, with something similar to:
>
[quoted text clipped - 12 lines]
>
> Any suggestions as to what is going on, or alternatives?
Change 'min-height' to 'height' and see what happens ;-)

Signature
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Phil - 25 Aug 2007 04:54 GMT
>> Having a problem in Firefox, with something similar to:
>>
[quoted text clipped - 14 lines]
>
> Change 'min-height' to 'height' and see what happens ;-)
Thanks for your reply.
This works in IE, but in Firefox, the div won't expand to fit any content
that's added.
Any other suggestions?
Jonathan N. Little - 25 Aug 2007 05:25 GMT
> This works in IE, but in Firefox, the div won't expand to fit any
> content that's added.
>
> Any other suggestions?
Works for me, maybe we need to see the rest of the page, eh?

Signature
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
rf - 25 Aug 2007 09:42 GMT
>>> Having a problem in Firefox, with something similar to:
>>>
[quoted text clipped - 19 lines]
> This works in IE, but in Firefox, the div won't expand to fit any content
> that's added.
IE is getting it wrong. Firefox is correct. If you give a div a specific
height then it will have that height. It should not expand.
http://developer.mozilla.org/en/docs/Migrate_apps_from_Internet_Explorer_to_Mozi
lla#CSS_overflow_differences

Signature
Richard.
Gus Richter - 25 Aug 2007 06:30 GMT
> Having a problem in Firefox, with something similar to:
>
[quoted text clipped - 12 lines]
>
> Any suggestions as to what is going on, or alternatives?
Will this do what you want it to?
<div style="border: thin solid blue; min-height: 15em; position:relative;">
<div style="border: thin solid red; height: 80%;
position:absolute;"></div>
</div>

Signature
Gus
Phil - 25 Aug 2007 18:02 GMT
>> Having a problem in Firefox, with something similar to:
>>
[quoted text clipped - 20 lines]
> position:absolute;"></div>
> </div>
Yes, it does. Thanks!
Any idea why Firefox acts the way it does in this situation? A bug maybe?
Gus Richter - 26 Aug 2007 03:00 GMT
> Any idea why Firefox acts the way it does in this situation? A bug maybe?
No bug. Fx follows the Specs.
The containing block for a positioned box is established by the nearest
*positioned* ancestor (or, if none exists, the initial containing block).
http://www.w3.org/TR/CSS21/visuren.html#positioning-scheme
http://www.w3.org/TR/CSS21/visudet.html#Computing_heights_and_margins
I also encourage you to Google Groups for 'containing block' and read up
on previous discussions.

Signature
Gus
Phil - 26 Aug 2007 05:03 GMT
>> Any idea why Firefox acts the way it does in this situation? A bug maybe?
>
[quoted text clipped - 8 lines]
> I also encourage you to Google Groups for 'containing block' and read up
> on previous discussions.
If this was the case, then wouldn't setting the outer div's position:
relative satisfy this requirement? Why does the inner div have to be
absolutely positioned also?
As you've given me a way around this, I guess it doesn't really matter.
Thanks for your help :)
Gus Richter - 26 Aug 2007 07:41 GMT
> If this was the case, then wouldn't setting the outer div's position:
> relative satisfy this requirement? Why does the inner div have to be
> absolutely positioned also?
>
> As you've given me a way around this, I guess it doesn't really matter.
In case it does matter, the answer is in:
<http://www.w3.org/TR/CSS21/visudet.html#min-max-heights>
But you have to read and understand the convoluted writeup in Sections 9
and 10 of the Specifications.
<http://www.w3.org/TR/CSS21/visuren.html>
<http://www.w3.org/TR/CSS21/visudet.html>

Signature
Gus
Good luck
Ben C - 28 Aug 2007 10:10 GMT
>> If this was the case, then wouldn't setting the outer div's position:
>> relative satisfy this requirement? Why does the inner div have to be
[quoted text clipped - 9 lines]
><http://www.w3.org/TR/CSS21/visuren.html>
><http://www.w3.org/TR/CSS21/visudet.html>
Just to clarify that a bit, the key point is in 10.5:
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'.
^^^^^^^^^^^^^^^^^^^^^
In the original example,
<div id="A">
<div id="B">
Both A and B have static position and A is the containing block for B.
But since A doesn't have an explicit height then the percentage height
for B is ignored ("computes to 'auto'").
This is because A's height depends on the height of its contents (which
consist of B), so asking for B's height to be a percentage of A's is
circular.
In Gus's version:
<div id="A" style="position: relative">
<div id="B" style="position: absolute">
A is still the containing block for B (position: relative is needed to
preserve that relationship) but in this case B _can_ be given a
percentage height of A's computed height.
This is because A's computed height depends on its normal flow
descendents (i.e. the ones that aren't absolutely positioned). The
height of A therefore does not depend on the height of B, as B _is_
absolutely positioned and so not a normal flow descendent. So there is
no circularity, and the percentage height makes sense.
Bergamot - 25 Aug 2007 14:01 GMT
> Having a problem in Firefox
> Any suggestions as to what is going on, or alternatives?
Post a URL if you don't want WAGs

Signature
Berg