gpt4 book ai didi

html - CSS 两个双 div,一个固定,一个水平移动

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

问题是一个div向下移动一个向上移动,为什么?我做了两个双 div,都是内联 block 和向右浮动,每个 block 内都一样。我尝试了很多更改,但没有任何解决方案。

.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
}
.lawyer-avatar {
display: inline-block;
height: 100px;
width: 100px;
float:right;
}
.lawyer-avatar-relative {
position: relative;
}
.lawyer-name-box{
position: absolute;
bottom: 0em;
right: 0em;
width: 100%;
height: 2em;
background: rgba(25, 126, 215, 0.9);
color: #fff;
}
.lawyer-name-box span{
padding: 10px 10px 10px 0;
}
.lawyer_description {
background: rgba(25, 126, 215, 0.5);
height: 100px;
width: 100px;
display: inline-block;
clear: right;
}
<div id="lawyer-1" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">short text</div>
</div>
<div id="lawyer-2" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">long text long text long text</div>
</div>

enter image description here

问题是一个div向下移动一个向上移动,为什么?我做了两个双 div,都是内联 block 和向右浮动,每个 block 内都一样。我尝试了很多更改,但没有任何解决方案。

最佳答案

您应该在您的 .lawyer-online 类中添加一个 vertical-align: top

.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
vertical-align: top;
}

关于html - CSS 两个双 div,一个固定,一个水平移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32081149/

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