background-repeatの使い方
Web標準HTML/CSS > background-repeatの使い方
background-repeat
プロパティの説明
background-repeatは、背景画像の設定を指定するプロパティです。全ての要素に指定することができます。
指定できる値
- repeat
- 標準設定。縦横ともに背景画像が繰り返されます。
- repeat-x
- 横に背景画像を繰り返すようにします。
- repeat-y
- 縦に背景画像を繰り返すようにします。
- no-repeat
- 背景画像を繰り返さないようにします。
サンプル
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"https://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>サンプルページ</title>
<style type="text/css">
<!--
.b1{
color:#000000;
background-color:#cccccc;
background-image:url(../img/wp/wall.gif);
background-repeat:repeat-x;
}
-->
</style>
</head>
<body>
<h1>サンプルページ</h1>
<p class="b1">背景画像を指定しています。</p>
</body>
</html>