サイト内検索

...スタイルシート(css)...

スタイルシート・table

セル内の背景画像

セル内の背景画像は、 background-imageプロパティを指定します。
[使い方]
th, td{
background-image: url(sample.jpg);
}
プロパティ名 説明
background-image: ; 「url(http://・・/sample.jpg);」
のように表示する画像(URL)を指定します。
外部ファイルで背景画像を表示させる場合
背景画像の外部スタイルシートファイル(.css)から見た
画像ファイルの相対アドレス(url)を記述します
table要素に
指定
全体に背景画像を指定できます。
table{
background-image: url(../sample.jpg);
}
NoNo
NoNo
tr要素に
指定
行単位で指定が出来ます。
tr{
background-image: url(../sample.jpg);
}
NoNo
NoNo
th,td要素に
指定
指定したい所を指定できます。
th,td{
background-image: url(../sample.jpg);
}
No No
No No

サンプル

[headの中]

<style type="text/css">
<!--
table{
border: 1px #999999 solid;
}
th.sample1, td.sample1{
border: 1px #999999 solid;
background-image: url(sample.jpg);
}
-->
</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.