Susy を使い始めたばかりで、達成したいことがありますが、Susy のドキュメントとオンライン チュートリアルを読んでいますが、その方法がわかりません。
私はこのhtmlを持っています:
<div class="page">
<nav>nav</nav>
<div class="main">
<div class="summary">
summary
</div>
<div class="content">
content
</div>
</div>
<footer>footer</footer>
</div>
およびこれらの Susy 設定:
$total-columns: 12;
$column-width: 4em;
$gutter-width: 1em;
$grid-padding: $gutter-width;
$show-grid-backgrounds: true;
@include border-box-sizing;
// breakpoint variables
$M: 30em;
$L: 50em;
そしてこのscss:
.page {
@include container;
@include susy-grid-background;
nav {
@include at-breakpoint($M) {
@include span-columns(2,12);
}
}
.main {
@include at-breakpoint($M) {
@include span-columns(10 omega,12);
}
.summary {
@include at-breakpoint($L) {
@include span-columns(2 omega,10);
}
}
.content {
@include at-breakpoint($L) {
@include span-columns(8,10);
}
}
}
footer {clear: both;}
それは期待どおりに機能し、コンテンツは最大幅で完全に流動的です。ただし、同じ動作が必要ですが、4 列のレイアウトから始めて、8 列、次に 12 列に変更します。
私はこのようにします:
$total-columns: 4;
$column-width: 4em;
$gutter-width: 1em;
$grid-padding: $gutter-width;
$show-grid-backgrounds: true;
@include border-box-sizing;
// breakpoint variables
$M: 30em;
$L: 50em;
そしてscss:
.page {
@include container;
@include susy-grid-background;
// Now create a media-query breakpoint at the min-width of 30em and use a larger grid and modify the layout
@include at-breakpoint($M 8) {
// This will create a new container with a total of 8 columns
@include container;
@include susy-grid-background;
// Now modify the inner elements to their new home
nav { @include span-columns(2,8); }
.main { @include span-columns(6 omega,8); }
}
@include at-breakpoint($L 12) {
// This will create a new container with a total of 12 columns
@include container;
@include susy-grid-background;
// Now modify the inner elements to their new home
nav { @include span-columns(2,12); }
.main {
@include span-columns(10 omega,12);
.content {
@include span-columns(8,10);
}
.summary {
@include span-columns(2 omega,10);
}
}
}
footer {clear: both;}
}
これも問題なく動作しますが、最初の例のようにすべてのレイアウトを流動的にすることはできません。たとえば、幅が 450 ピクセルの場合、4 列のレイアウトはビューポートを埋めません。768px でも同じことが起こり、8 列ではビューポートがいっぱいになりません。最初の例のように、レイアウトが常に利用可能な幅を埋め、定義されたブレークポイントに従って列を変更したいと思います。
それは Susy の通常の動作ですか、それとも別の方法で行うことは可能ですか?
これが初心者の質問である場合は申し訳ありませんが、私はまだ始めたばかりであり、実際のプロジェクトで Susy を使用する前に明確にしたいと思います。
ありがとう。