gpt4 book ai didi

css - 当我输入文本时,子 div 向下移动

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

这是我的代码:

#wrapper {
margin: 0 auto;
display: block;
width: 1200px;
border: 1px solid red;
}

div {
width: 150px;
height: 200px;
border: 1px solid red;
display: inline-block;
margin-right: 80px;
}
<div id="wrapper">
<div>this is test. this is test.</div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>

最佳答案

永远记得为 inline-block 元素定义 vertical-align

#wrapper {
margin: 0 auto;
display: block;
width: 1200px;
border: 1px solid red;
}

div {
width: 150px;
height: 200px;
border: 1px solid red;
display: inline-block;
vertical-align: top; /* add this always with inline-block */
margin-right: 80px;
}
<div id="wrapper">
<div>thisd ihd sofjdlkfj dlkfjdlkfj d</div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>

关于css - 当我输入文本时,子 div 向下移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43387519/

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