| 変化例 |
プロパティ |
値 |
書き方の例 |
| 背景色を指定する |
background-color |
色コード、 又は色名、 transparent(透明) |
td{background-color: #339966;} |
| 背景画像を指定する |
background-image |
url(背景画像のURL) |
td{background-image:url(images/stories/aomori_img.gif);} |
背景画像の繰り返し方法を指定する
|
全体に 繰り返す
|
|
水平方向に 繰り返す
|
|
垂直方向 に繰り返す
|
|
繰り返さず、 1つだけ配置
|
|
background-repeat |
| repeat |
| repeat-x |
| repeat-y |
| no-repeat |
|
td{background-repeat:repeat;} |
背景画像の位置を指定する
|
左上に 配置
|
|
中央に 配置
|
|
右下に 配置
|
|
左から2em、 上から10px の位置に配置
|
|
background-position |
水平方向・垂直方向の順で 「数値+単位」で指定するか、 下記のように指定
| 水平方向 | 垂直方向 |
| left |
top |
| center |
center |
| right |
bottom |
|
td{background-position:left top;}
td{background-position:2em 10px;}
|