サイト内検索
...スタイルシート(css)...
スタイルシート・table
セル内の背景色
- セル内の背景色は、background-colorプロパティを指定します。
- 16進数RGB値(例・・#fff000)またはカラーネーム(例・・red)を指定します。
- [使い方]
- th, td{
border: 1px #999999 solid;
background-color: #ffff8e;
}
プロパティ名 | 値 | 説明 |
---|---|---|
background-color: | ; |
16進数RGB値(例・・#fff000)
または カラーネーム(例・・red)を指定します。 |
table要素に指定 | 全体の指定が出来ます。
table{background-color: #ffff8e;} |
|
||||
tr要素に指定 | 行単位で指定が出来ます。
tr{background-color: #ffff8e;} |
|
||||
th,td要素に指定 | 指定したい所を指定できます。
th, td{background-color : #ffff8e;} |
|
サンプル
[headの中] <style type="text/css"><!-- table{ border: 1px #999999 solid; background-color: #ccff99; } th.sample1, td.sample1{ border: 1px #999999 solid; background-color: #ffff8e; } --> </style> |
|||||
[bodyの中] <table><tr> <th class="sample1">No1</th> <th>No2</th> </tr> <tr> <td>No3</td> <td class="sample1">No4</td> </tr> </table> |
[ブラウザ上]
|