gpt4 book ai didi

css -
元素落在边框之外

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

我试图在 Test1 周围绘制黑色边框 - Test4 也跨越 Test5。目前,Test5 落在外面。有谁知道如何绘制它以包含 Test5

.description {
border: 1px solid;
}

.descriptionTop {
display: inline-block;
}

.ao {
padding: 5px;
font-weight: 700;
text-transform: uppercase;

}

.pr {
text-align: right;
float: right;
}

.pm {
border: solid 1px #53a318;
border-radius: 3px;
color: #53a318;
box-sizing: border-box;
font-size: 12px;
float: right;
padding: 2px 8px;
}
<div class="description">
<div class="descriptionTop">
<span class="descriptionLeft">Test1</span>
<span class="ao">Test2</span>
</div>
<div class="pr">
<div>
<span>Test3</span>
<span>Test4</span>
</div>
<div class="pm">Test5</div>
</div>
</div>

最佳答案

overflow: auto; 添加到容器以包含 float 元素:

.description {
border: 1px solid;
overflow: auto;
}

.descriptionTop {
display: inline-block;
}

.altOffer {
padding: 5px;
font-weight: 700;
text-transform: uppercase;

}

.prices {
text-align: right;
float: right;
}

.promotion {
border: solid 1px #53a318;
border-radius: 3px;
color: #53a318;
box-sizing: border-box;
font-size: 12px;
float: right;
padding: 2px 8px;
}
<div class="description">
<div class="descriptionTop">
<span class="descriptionLeft">Test1</span>
<span class="altOffer">Test2</span>
</div>
<div class="prices">
<div>
<span>Test3</span>
<span>Test4</span>
</div>
<div class="promotion">Test5</div>
</div>
</div>

关于css - <div> 元素落在边框之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51949031/

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