强制子div占父母身高的100%

时间:2021-08-06 21:27:46

I am designing a fluid layout (no fixed px, all in %)

我正在设计流畅的布局(没有固定的px,全部为%)

I have the HTML as;

我有HTML作为;

<div class="parent">
<div class="fl child"><a class="prev"></a></div>
</div>

If I check in Firebug, the height of parent is calculated as 400px..But if I give child as height:100%, it does not take the entire height..

如果我签入Firebug,父亲的高度计算为400px ..但是如果我给孩子身高:100%,它不会占用整个身高..

How do I fix this?

我该如何解决?

1 个解决方案

#1


0  

Unfortunately heights don't work so well with percentages, you can take a look at the min-height css property but you may need to employ some javascript.

不幸的是,高度不能很好地与百分比一起工作,你可以看一下min-height css属性,但你可能需要使用一些javascript。

#1


0  

Unfortunately heights don't work so well with percentages, you can take a look at the min-height css property but you may need to employ some javascript.

不幸的是,高度不能很好地与百分比一起工作,你可以看一下min-height css属性,但你可能需要使用一些javascript。