【发布时间】:2016-08-30 05:40:51
【问题描述】:
我喜欢 Bootstrap 使用填充然后负边距“行”以使所有内容对齐的方式。在尝试删除某些东西的排水沟时,它不再需要 :nth-child 选择器。
但我喜欢在地图中指定排水沟的能力,并且它们被设置为百分比。我已经设法做到了,但感觉很笨拙,想知道是否有更好的方法。
配置:
$split-gutter: (
columns: 12,
gutters: .8
);
得到一半的装订线值:
$susy-split-gutter-width: (span(1) * map-get($split-gutter, gutters)) / 2;
行样式:
.row {
@include clear;
margin-left: -$susy-split-gutter-width;
margin-right: -$susy-split-gutter-width;
}
设置基列样式:
[class^="col-"] {
float: left;
padding-left: $susy-split-gutter-width;
padding-right: $susy-split-gutter-width;
}
设置列的宽度:
.col-1 {
width: span(1);
}
.col-2 {
width: span(2);
}
...etc
没关系。但感觉就像我正在侵入 susy 价值观,我不确定这是否很棒。有没有更好的办法?
【问题讨论】: