【发布时间】:2020-07-27 03:16:16
【问题描述】:
我正在尝试使用弹性框创建一个包含 3 个 div 的表格,但是当我为 div 添加边框时,边框并没有在下一个 div 的顶部对齐。任何有鹰眼斑点的人我都想念什么? 谢谢!
.content div {
width: 350px;
border: solid;
padding: 6px;
}
p {
font-size: medium;
font-weight: 700;
color: #000;
margin-left: 10px;
}
.content {
height: 50px;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.red {
display: flex;
align-items: center;
justify-content: center;
}
.green {
display: flex;
align-items: center;
justify-content: center;
}
.blue {
display: flex;
align-items: center;
justify-content: center;
}
<div class="content">
<div class="red"><img src="https://i.ibb.co/7YJB7QC/flag.png" alt="flag" border="0" width="40" height="40">
<p>100% Made in the USA</p>
</div>
<div class="green"><img src="https://i.ibb.co/dmDyGKH/100.png" alt="100" border="0" width="40" height="40">
<p>100% Happiness Guaranteed</p>
</div>
<div class="blue"><img src="https://i.ibb.co/zmK0Jk0/check.png" alt="check" border="0" width="40" height="40">
<p>100% Secure Checkout</p>
</div>
<table>
</table>
</div>
【问题讨论】:
-
因为flexbox没有border-collapse?是这个意思吗?
-
他们正在排队,但边框围绕着整个 div。所以你会看到顶部 div 的底部边框和下一个 div 的顶部边框接触。您可以将中间 div 的border-top 和border-bottom 设置为none。
-
善用代码 sn-p,@jackstrum。欢迎来到 SO