background-repeat: ***;
background-repeat は、背景画像の並び方を指定するプロパティです。
このプロパティをbody要素に対して設定すると、文書全体の背景画像の並び方を指定することができます。
body {
background-image: url(back.gif);
background-repeat: repeat-y;
}
| プロパティ名 | 値 | 説明 |
|---|---|---|
| background-repeat | repeat | 敷き詰める (初期値) |
| repeat-x | 水平方向に並べる | |
| repeat-y | 垂直方向に並べる | |
| no-repeat | 1つだけ表示する |
使用例
■repeat-y (垂直方向の並び)を指定した例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>
<style type="text/css">
body {
background-color: #f0f0f0;
background-image: url(neko.gif);
background-repeat: repeat-y;
color: #000000;
}
</style>
</head>
<body>
</body>
</html>
表示例
■その他の使用例
表示例
- background-repeat: repeat-x;
… 水平方向の並びを指定した例 - background-repeat: no-repeat;
… 1つだけ表示した例 - background-repeat: repeat;
… 敷き詰めた例
- サイト内検索
![[背景画像]](image/neko.gif)