且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Divs - 延伸到可变高度

更新时间:2023-10-08 19:10:17

您好,


在CSS代码的第75行,您将div#navigationContainer的高度设置为0px。当百分比用于宽度或高度时,这是元素包含块的百分比。由于div#returnMenu的父级是div#navigationContainer,因此高度计算为0px的100%,因此div的高度为零。


为了让你在正确的路径上更改第75行CSS为:
Hi,

On line 75 of the CSS code you set the height of the div#navigationContainer to 0px. When a percentage is used for either a width or height this is a percentage of an element''s containing block. Since the parent of div#returnMenu is div#navigationContainer the height calculates to 100% of 0px, therefore the div has zero height.

To put you on the right path change line 75 of the CSS to :
展开 | 选择 | Wrap | 行号


我刚刚看了一眼,现在看起来在IE7中看起来更好了和Firefox在IE6中看起来不正确。我明天会再看一眼,因为我现在时间不够。
I''ve just had another quick glance at this and while it now looks better in IE7 and Firefox it does not look correct in IE6. I will have another look tomorrow as I am short of time at the moment.


高度:auto也不起作用(以前用它)。我认为它不起作用,因为父母试图缩小到内容(高度:自动),内容正在尝试扩展到父级(高度:100%)。

我尝试过#returnMenu使用javascript跳出父级和匹配高度,但javascript读取变量高度为null:S(即使使用.pixelHeight)。我可能会尝试将它们放在桌子的一排,因为它将匹配高度,但不确定是否能够使该行上的td'重叠,同时保持匹配的高度。


欢呼
The height: auto does not work either (used to have it at that). I think its not working because the parent is trying to shrink to the contents (Height: auto) and the contents are trying to expand to the parent (height: 100%).
I have tried taking the #returnMenu out of the parent and matching height using javascript but the javascript reads a variable height as null :S (even when using .pixelHeight). I may try to have them both in a row of a table next as it will match the heights but not sure if ill be able to make the td''s on that row overlap while keeping the matched heights.

cheers