【发布时间】:2021-10-19 19:13:31
【问题描述】:
我使用 sass 创建了一个包含 12 列的动态网格系统,其中包含 flexbox “就像使用的一个引导程序”。我在项目之间使用了 1em 的“间隙”,但这会影响项目的宽度,并让其中一个包裹在底部。如何让项目宽度也包括获取所有项目的间隙
<section className="container">
<h1>This Is Section One</h1>
<div className="row">
<div className="card col-4">
<p>For Parteners</p>
</div>
<div className="card col-4">
<p>For Students</p>
</div>
<div className="card col-4">
<p>For Innovators</p>
</div>
</div>
</section>
// Scss
@for $i from 1 through $grid_columns{
.col#{$modifier}-#{$i}{
flex: 0 0 100%/$grid_columns * $i
}
.container{
max-width: $grid_bp-md *1px;
margin: 0 auto;
&-fluid{
max-width: 100%;
margin: 0;
}
}
.row{
display: flex;
flex-wrap: wrap;
width: 100%;
gap: 1em;
}
【问题讨论】:
标签: css user-interface sass flexbox