gpt4 book ai didi

html - 内联列被下推

转载 作者:太空宇宙 更新时间:2023-11-04 10:09:35 25 4
gpt4 key购买 nike

我有一个 40% 和一个 60% 的内联列,但出于某种原因,当我将内容放入其中时,其中一个容器被下推了。有谁知道为什么会这样?

Here is a fiddle

HTML

<div class="grid">
<div class="long-col">a</div>
<div class="small-col">
<div style="font-size:18px;width:100%;">a</div>
<div style="font-size:18px;width:100%;">b<div>
</div>
</div>

CSS

.grid { font-size:0px;}
.grid .long-col {
display:inline-block;
width:40%;
height:500px;
background-color:green;
}
.grid .small-col {
display:inline-block;
width:60%;
height:500px;
background-color:yellow;
}

最佳答案

添加vertical-align top

.grid .long-col {
background-color: green;
display: inline-block;
height: 500px;
vertical-align: top;
width: 40%;
}
.grid .small-col {
background-color: yellow;
display: inline-block;
height: 500px;
vertical-align: top;
width: 60%;
}

关于html - 内联列被下推,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37717722/

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