gpt4 book ai didi

css - DIV 高度不根据 css 改变

转载 作者:太空宇宙 更新时间:2023-11-04 03:56:53 24 4
gpt4 key购买 nike

因此,我在表单中放置了一个 div。表单在 min-height 100% 处拉伸(stretch),但子 div 在将 height 或 min-height 设置为 100% 后拒绝拉伸(stretch)。但是当表单高度不是最小高度设置为 100% 时,div 会拉伸(stretch)。为什么会这样?

<form>
<div id="host">
</div>
</form>

body, html{
height: 100%;
}
form
{
min-height: 100%;
}

#host{
min-height: 100%;
background-color: red;
}

http://jsfiddle.net/fkuE8/

最佳答案

min-height: 用于设置元素的最小高度,例如

  height: 100%;         /* full height  */
min-height: 100px; /* at least 100px */

如果你设置一个百分比,它将使用尽可能少的空间

关于css - DIV 高度不根据 css 改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22674504/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com