backgroundの使い方
Web標準HTML/CSS > backgroundの使い方
background
プロパティの説明
backgroundは、背景に関する全ての設定をまとめて指定することができるプロパティです。全ての要素に指定することができます。
指定できる値
- 色(backgroud-color)
- CSSで定義された色の値 または transparent
- 画像(backgroud-image)
- 画像をおいたURL
- 画像の繰り返し(backgroud-repeat)
- repeat, repeat-x, repeat-y, no-repeat
- 画像の位置(backgroud-position)
- %, left, center, right, top, center, bottom
- 画像の固定(backgroud-attachment)
- scroll, fixed
サンプル
<!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">
<!--
body{
color:#000000;
background:#cccccc url(../img/wp/wall.gif);
}
-->
</style>
</head>
<body>
<h1>サンプルページ</h1>
<p>背景色と背景画像を同時に指定。</p>
</body>
</html>