gpt4 book ai didi

html - 等高嵌套div

转载 作者:行者123 更新时间:2023-11-28 13:41:59 25 4
gpt4 key购买 nike

左右两列各有2个不同高度的嵌套div。
这些 div 形成一个类似框架的形状。参见 http://jsfiddle.net/5fA3q/ .

我尝试了不同的 css 等高技巧,它们可以工作,但不能在这种情况下使用,而且几乎可以使用
padding-bottom:999999px;
margin-bottom:-999999px;
absolute 定位 较短 的 inner-div。

但是,padding-bottom 不见了。参见 http://jsfiddle.net/5fA3q/11/

我希望有人知道解决方法。

最佳答案

您可以使用 display:table-cell,但请注意它不适用于旧浏览器。

HTML:

<div class="wrapper">
<div class="left">
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
<p>Left</p>
</div>
<div class="separator"></div>
<div class="right">
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
<p>Right</p>
</div>
</div>
<div class="footer"></div>

CSS:

.wrapper{
width: 500px;
display:table;
}
.wrapper>div{display:table-cell;}
.left{
border:10px solid #0188ed;
margin-right:10px;
background: #0150e1;
width: 180px;
}
.right{
width:270px;
border:10px solid #0188ed;
background: #0150e1;
}
.footer{
background:#0181ec;
height: 50px;
width: 500px;
border-top: 10px solid #ffffff;
}

DEMO: http://jsfiddle.net/5fA3q/12/

关于html - 等高嵌套div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12283956/

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