サイト内検索

...スタイルシート(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;}
NoNo
NoNo
tr要素に指定 行単位で指定が出来ます。
tr{background-color: #ffff8e;}
NoNo
NoNo
th,td要素に指定 指定したい所を指定できます。
th, td{background-color : #ffff8e;}
No No
No No

サンプル

[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">No</th>
<th>No</th>
</tr>
<tr>
<td>No</td>
<td class="sample1">No</td>
</tr>
</table>

[ブラウザ上]

NoNo
NoNo

Copyright c 2007.10.01 luc All rights reserved.