如果你看看整洁的核心,你会看到
// Flexible gutter
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($gutter / $container-width);
}
如果您查看 _span-columns.scss,您会看到:
margin-#{$direction}: flex-gutter($container-columns);
所以你可以取一个网格,如果你使列大于 12。即 24 你是那个边距的一半。如果你把它加倍到 48 它是原来的 1/4。等等..所以你有能力将你的列调整到任何总大小,并在此基础上让你的排水沟变得灵活。您总是可以反转效果或尝试不同的列大小来获得不同的结果。这有什么帮助吗?或者至少是它背后的理论?
div.container {
@include outer-container()
}
div.small {
background: red;
@include span-columns(3 of 12);
}
div.small-alt {
background: blue;
@include span-columns(6 of 24);
}
div.small-crazy {
background: green;
@include span-columns(36 of 144);
}
<div class="container">
<div class="small">1</div>
<div class="small">2</div>
<div class="small">3</div>
<div class="small">4</div>
</div>
<div class="container">
<div class="small-alt">1</div>
<div class="small-alt">2</div>
<div class="small-alt">3</div>
<div class="small-alt">4</div>
</div>
<div class="container">
<div class="small-crazy">1</div>
<div class="small-crazy">2</div>
<div class="small-crazy">3</div>
<div class="small-crazy">4</div>
</div>