container
は、より大きなビューポートでコンテンツを中央揃えするために使用できるシンプルなユーティリティ要素です。どのようなコンテキストでも使用できますが、主に以下のいずれかの直接の子要素として使用されます。
ナビゲーションバー
ヒーロー
セクション
フッター
コンテナ
コンテンツを水平方向に中央揃えするためのシンプルなコンテナ
container
は、より大きなビューポートでコンテンツを中央揃えするために使用できるシンプルなユーティリティ要素です。どのようなコンテキストでも使用できますが、主に以下のいずれかの直接の子要素として使用されます。
ナビゲーションバー
ヒーロー
セクション
フッター
下記1023px
|
デスクトップ1024px と1215px の間 |
ワイドスクリーン1216px と1407px の間 |
フルHD1408px 以上 |
|
---|---|---|---|---|
クラス | max-width |
|||
.container |
全幅 |
960px
|
1152px
|
1344px
|
.container.is-widescreen |
全幅 |
1152px
|
1344px
|
|
.container.is-fullhd |
全幅 |
1344px
|
||
.container.is-max-desktop |
全幅 |
960px
|
||
.container.is-max-widescreen |
全幅 |
960px
|
1152px
|
デフォルトでは、container
は$desktop
ブレークポイントからしかアクティブになりません。$widescreen
と$fullhd
ブレークポイントに達すると、max-width
が増加します。
各ブレークポイントでのコンテナの幅は、$device - (2 * $gap)
の結果です。$gap
変数のデフォルト値は32px
ですが、変更できます。
コンテナは次のように動作します。
$desktop
では、最大幅は960pxになります。$widescreen
では、最大幅は1152pxになります。$fullhd
では、最大幅は1344pxになります。値960、1152、1344は、12と16の両方で割り切れるように選択されています。
<div class="container">
<div class="notification is-primary">
This container is <strong>centered</strong> on desktop and larger viewports.
</div>
</div>
is-widescreen
とis-fullhd
の2つの修飾子を使用すると、それらの特定のブレークポイントまで、フル幅のコンテナを持つことができます。
$widescreen
ブレークポイントまでフル幅です。<div class="container is-widescreen">
<div class="notification is-primary">
This container is <strong>fullwidth</strong> <em>until</em> the
<code>$widescreen</code> breakpoint.
</div>
</div>
$fullhd
ブレークポイントまでフル幅です。<div class="container is-fullhd">
<div class="notification is-primary">
This container is <strong>fullwidth</strong> <em>until</em> the
<code>$fullhd</code> breakpoint.
</div>
</div>
より大きなビューポートで狭いコンテナが必要になる場合があります。そのため、Bulmaは2つの修飾子を提供しています。
.container.is-max-desktop
はデスクトップコンテナのように動作します。.container.is-max-widescreen
はワイドスクリーンコンテナのように動作します。max-width
が$desktop - $container-offset
になります。<div class="container is-max-desktop">
<div class="notification is-primary">
This container has a <code>max-width</code> of
<code>$desktop - $container-offset</code> on widescreen and fullhd.
</div>
</div>
max-width
が$widescreen - $container-offset
になります。<div class="container is-max-widescreen">
<div class="notification is-primary">
This container has a <code>max-width</code> of
<code>$widescreen - $container-offset</code> on fullhd.
</div>
</div>
すべてのコンテナの最大幅を変更する場合は、$container-max-width
Sass変数の値を更新することで実行できます。
デフォルトでは、$fullhd
ブレークポイントの値を使用して、container
の絶対最大幅が計算されます。それを$widescreen
、$desktop
、またはピクセル単位の任意の値に小さく変更するだけです。
最大幅を設けずに、左右に32pxのマージンを維持したい場合は、is-fluid
修飾子を追加します。
<div class="container is-fluid">
<div class="notification is-primary">
This container is <strong>fluid</strong>: it will have a 32px gap on either
side, on any viewport size.
</div>
</div>
Sass変数
|
CSS変数
|
値
|
---|---|---|
|
|
|
|
|
|
Sass変数
|
CSS変数
|
値
|
---|---|---|
|
|
|
|
|
|