背景画像の並び方を指定する

[新着] TAG indexオフライン版 3.0 を準備中です


background-repeat: ***;

ブラウザ
Internet Explorer Netscape Firefox Opera
参考
書式基本 要素名 クラス ID

background-repeat は、背景画像の並び方を指定するプロパティです。


div {
background-image: url(image/back.gif);
background-repeat: repeat-y;
}


background-repeat repeat-x … (横方向に並べる)
repeat-y … (縦方向に並べる)
no-repeat … (1つだけ表示する)
repeat … (敷き詰める)デフォルト

使用例

<html>
<head>
<title>TAG index Webサイト</title>

<style type="text/css">
<!--

div {
width: 70%;
height: 200px;
margin: 10px 0;
background-color: #ffffff;
background-image: url(image/back.gif);
color: red;

}

#example1 { background-repeat: repeat-x; }
#example2 { background-repeat: repeat-y; }
#example3 { background-repeat: no-repeat; }
#example4 { background-repeat: repeat; }


-->
</style>

</head>
<body>

<div id="example1">横方向に並べる</div>
<div id="example2">縦方向に並べる</div>
<div id="example3">1つだけ表示する</div>
<div id="example4">敷き詰める</div>

</body>
</html>

これをブラウザで見ると次のように表示されます

横方向に並べる
縦方向に並べる
1つだけ表示する
敷き詰める

背景 (この画像を背景にしています)



[特集] レンタルサーバー比較 & サーバー選びのチェックポイント

サイト内検索について - ベーシック版