gpt4 book ai didi

html - 溢出我的高度

转载 作者:行者123 更新时间:2023-11-28 04:34:30 25 4
gpt4 key购买 nike

我希望我的容器 DIV 在我添加一些带有 JS 或 CSS 的 DIV(悬停)时自动扩展其高度

我试过了,但是有一个溢出你可以在这个 FIDDLE 看到它:

HTML:

<div class="container" >
<div class="hov">Hello</div>
<div class="sub"></div>
</div>

CSS:

.container {
background-color: beige;
height: 80px;
width: 200px;
padding: 10px;

}
.sub {
background-color: yellow;
height: 80px;
width: 200px;
display: none;
}
.hov:hover + div {
display: block;
}

.hov {
cursor: pointer;
}

最佳答案

使用min-height代替height

See JSFiddle

关于html - 溢出我的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23361514/

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