gpt4 book ai didi

html - CSS 表现异常

转载 作者:行者123 更新时间:2023-11-28 15:13:03 26 4
gpt4 key购买 nike

当我将 div2 放在 div1 中时,div1 只是随机下降了一些。不确定这里发生了什么,因为我只是将 div3 放在 div1 中并且它工作得很好。

.propertyOverview {
height: 430px;
width: 357px;
margin-right: 10px;
margin-top: 15px;
background-color: white;
display: inline-block;
border: solid 1px #E8E8E8;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}

.propertyImage {
height: 260px;
width: 355px;
background-color: #a29c9c;
border-radius: 5px 5px 0 0;
margin-left: -15px;
}
<div class="col-sm-10 col-sm-offset-1">
<div class="container propertyOverview">
<div class="propertyImage"></div>
<div>
Sample text
</div>
</div>

Screen shot of what I'm looking at

最佳答案

inline-block 元素应用 vertical-align:top,因为默认对齐方式是基线。它将解决问题。

.propertyOverview {
height: 430px;
width: 357px;
margin-right: 10px;
margin-top: 15px;
background-color: white;
display: inline-block;
vertical-align:top; /* Added this one for alignment */
border: solid 1px #E8E8E8;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}

关于html - CSS 表现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47899714/

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