html - 在列之间添加空格而不丢失网格系统布局
问题描述
我想在不丢失网格系统布局的情况下在列之间添加空格,当我向卡片添加边距时,布局变为 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>
解决方案
由于我们看不到您的所有 CSS,我不知道这是否确定,但请尝试使用grid-row-gap
andgrid-column-gap
来表示行间距和列间距。您还可以使用grid-template-columns
来指定所需的列数。
希望这可以帮助!!蒂列尔
推荐阅读
- android - OpenId App Auth Android - 将刷新的访问令牌发送到 vuejs
- kubernetes - Kubernetes pod 是否在容器运行时内运行?
- postgresql - 通用数据库计数器
- dbus - lxc与主机之间的D-BUS通信
- google-bigquery - 分析函数 Big Query 中的条件平均值
- html - IOS中的file:///android_asset
- amazon-web-services - Step Functions - 在后面的步骤中使用旧步骤的输出(非顺序)
- c# - 编写需要包装需要 System.Web.Services 的 3rd-Party DLL 的 .NET5 WPF 的最佳方法是什么
- r - 根据值绘制带有彩色圆圈的矩阵
- python - Python Selenium 等待。当页面相同时防止过时错误