レスポンシブ グリッドに、Thoughtbot の Bourbon Neat を使い始めています。全体的にはとても洗練されていて、とても気に入っていますが、ちょっとした問題が 1 つあります。
マージンなしで2つの列を隣り合わせにしようとしていますが、例からそれらが持っているものを複製しようとした後、同じ結果が得られません.
サンプルの HTML は次のとおりです。
<section>
<p>
This is the main section.
</p>
<div class="container">
<p>
This is the container
</p>
<div class="col1">
<p>
This is the 1st column.
</p>
</div>
<div class="col2">
<p>
This is the 2nd column.
</p>
</div>
</div>
</section>
これが私のSCSSです:
section {
@include outer-container;
text-align: center;
}
.container {
@include span-columns (12);
text-align: center;
margin: 0;
padding: 0;
.col1 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
}
.col2 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
}
}
これが生成されます:
しかし、例が示すように、table メソッドを使用して 2 つの列を互いにネスト/突き合わせようとすると、次のようになります。
SCSS:
section {
@include outer-container;
text-align: center;
}
.container {
@include span-columns (12);
@include row (table);
text-align: center;
margin: 0;
padding: 0;
.col1 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
}
.col2 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
@include reset-display;
}
}
出力:
機能するルートに行く@include omega();
と、最後の列の全幅を拡張しません:
SCSS:
section {
@include outer-container;
text-align: center;
}
.container {
@include span-columns (12);
text-align: center;
margin: 0;
padding: 0;
.col1 {
@include span-columns(6);
@include omega();
background: #ccc;
@include pad(em(15));
}
.col2 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
@include omega();
}
}
出力:
基本的に、コンテナ セクションにあるコンテンツを省略して、探している結果が得られるようにすることができます。しかし、それを達成するために空を作成する必要がありますdiv
か?:
SCSS
section {
@include outer-container;
text-align: center;
}
.container {
@include span-columns (12);
@include row(table);
text-align: center;
margin: 0;
padding: 0;
.col1 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
}
.col2 {
@include span-columns(6);
background: #ccc;
@include pad(em(15));
@include reset-display
}
}
HTML ( 内のコンテンツ.container
はコメント化されています):
<section>
<p>
This is the main section.
</p>
<div class="container">
<!-- <p>
This is the container
</p> -->
<div class="col1">
<p>
This is the 1st column.
</p>
</div>
<div class="col2">
<p>
This is the 2nd column.
</p>
</div>
</div>
</section>
出力:
とにかく、これを達成するための「適切な」方法が何であるかわかりません。ドキュメントは、2 つの列を互いに入れ子にする方法を説明するための具体的なものではありません。そして、私が彼らの例で再現しようとしたことから、同じ結果が得られませんでした.
margin:0;
最後の列に a を特に追加する必要がない限り。