1. 背景
  2. background-repeat

背景

background-repeat

要素の背景画像の繰り返しを制御するためのユーティリティ。

クラススタイル
bg-repeat
background-repeat: repeat;
bg-repeat-x
background-repeat: repeat-x;
bg-repeat-y
background-repeat: repeat-y;
bg-repeat-space
background-repeat: space;
bg-repeat-round
background-repeat: round;
bg-no-repeat
background-repeat: no-repeat;

基本的な例

bg-repeat ユーティリティを使用して、背景画像を垂直方向と水平方向の両方に繰り返します。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-repeat ..."></div>

水平方向に繰り返す

bg-repeat-x ユーティリティを使用して、背景画像を水平方向のみに繰り返します。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-repeat-x ..."></div>

垂直方向に繰り返す

bg-repeat-y ユーティリティを使用して、背景画像を垂直方向のみに繰り返します。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-repeat-y ..."></div>

クリッピングの防止

bg-repeat-space ユーティリティを使用して、背景画像をクリッピングせずに繰り返します。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-repeat-space ..."></div>

クリッピングとギャップの防止

bg-repeat-round ユーティリティを使用して、背景画像をクリッピングせずに繰り返し、ギャップを避けるために必要に応じて引き伸ばします。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-repeat-round ..."></div>

繰り返しの無効化

bg-no-repeat ユーティリティを使用して、背景画像の繰り返しを防止します。

<div class="bg-[url(/img/clouds.svg)] bg-center bg-no-repeat ..."></div>

レスポンシブデザイン

プレフィックスa background-repeat ユーティリティ md: のようなブレークポイントバリアントとともに使用して、ユーティリティを適用するmedium 画面サイズ以上

<div class="bg-repeat md:bg-repeat-x ...">
<!-- ... -->
</div>

バリアントの使用方法の詳細については、バリアントのドキュメントをご覧ください。

Copyright © 2025 Tailwind Labs Inc.·商標ポリシー