gpt4 book ai didi

html - CSS : strange behaviour when displaying divs side by side

转载 作者:行者123 更新时间:2023-11-28 00:42:06 25 4
gpt4 key购买 nike

<分区>

我正在尝试使用 css 属性 display:inline-block; 为子级并排显示一些 div,为父级/容器使用 position:relative如以下代码所述:

<div style="margin-top: 20px; position: relative;">
<div style="margin: 15px; border: solid 2px; width: 130px; height: 130px; padding: 10px; text-align: center; display:inline-block;">
test test test
</div>
<div style="margin: 15px; border: solid 2px; width: 130px; height: 130px; padding: 10px; text-align: center; display:inline-block;">
test test test test test test test test test test test test test test test test test test
</div>
<div style="margin: 15px; border: solid 2px; width: 130px; height: 130px; padding: 10px; text-align: center; display:inline-block;">
test test test
</div>
<div style="margin: 15px; border: solid 2px; width: 130px; height: 130px; padding: 10px; text-align: center; display:inline-block;">
test test test
</div>
</div>

但当其中一个 div 包含长文本时,结果会有所不同

enter image description here

这个怎么解释。

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