【发布时间】:2020-10-07 07:11:45
【问题描述】:
我想在不丢失网格系统布局的情况下在列之间添加空格,当我向卡片添加边距时,布局变为 3 张卡片而不是 4 张卡片
这是代码,问题是我无法控制卡片之间的间距,每行应该是四张卡片
<div class ="container">
<div class ="row">
<div class ="d-flex flex-wrap">
<div class ="card p-0 col-12 col-lg-3">
<img src = "#">
[i write the title here]<p> .... </p>
</div>
<div class ="card p-0 col-12 col-lg-3">
<img src = "#">
<p> .... </p>
</div>
<div class ="card p-0 col-12 col-lg-3">
<img src = "#">
<p> .... </p>
</div>
<div class ="card p-0 col-12 col-lg-3">
<img src = "#">
<p> .... </p>
</div>
</div>
</div>
</div>
<style>
.card img{
width:100%;
}
..card p{
width:100%;
color : green;
font-size :18px;
float:right
}
</style>
【问题讨论】:
-
请点击编辑,然后点击
[<>]sn-p 编辑器并用css和相关脚本创建minimal reproducible example -
我添加了显示布局的图像
-
我们也需要你的 CSS
-
你在使用两个网格系统...
row、col-12和像d-flex这样的弹性实用程序。我想也许你想放弃 flex 实用程序 - 引导网格系统是建立在 flex 上的,所以把实用程序类放在那里可能会把事情搞砸。在您花时间解决保证金问题之前,我会删除实用程序。 -
如果你想添加空格那你为什么要使用
p-0?
标签: html css bootstrap-4 flexbox