visibility: collapse;

ブラウザ
  • IE
  • Fx
  • O
プロパティ

visibility は、表示・非表示を指定するプロパティです。

このプロパティ(値 collapse)を表の行・行グループ、列・列グループに対して設定すると、その範囲を詰めて表示することができます。


tr.example {
visibility: collapse;
}

プロパティ名 説明
visibility collapse 表の行または列を詰める

適用可能な要素について

このスタイルは次の要素に適用することができます。

使用例

行を詰めた例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>

<style type="text/css">

table, td, th {
border: 2px #2b2b2b solid;
}

tr.example1 {
visibility: collapse;
}

</style>

</head>
<body>

<table>
<tr>
<th>見出し1</th>
<th>見出し2</th>
<th>見出し3</th>
</tr>
<tr>
<td>データ1-1</td>
<td>データ1-2</td>
<td>データ1-3</td>
</tr>
<tr class="example1">
<td>データ2-1</td>
<td>データ2-2</td>
<td>データ2-3</td>
</tr>
<tr>
<td>データ3-1</td>
<td>データ3-2</td>
<td>データ3-3</td>
</tr>
</table>

</body>
</html>

表示例
見出し1 見出し2 見出し3
データ1-1 データ1-2 データ1-3
データ2-1 データ2-2 データ2-3
データ3-1 データ3-2 データ3-3
列を詰めた例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>

<style type="text/css">

table, td, th {
border: 2px #2b2b2b solid;
}

col.example2 {
visibility: collapse;
}

</style>

</head>
<body>

<table>

<col span="1">
<col span="1" class="example2">
<col span="1">

<tr>
<th>見出し1</th>
<th>見出し2</th>
<th>見出し3</th>
</tr>
<tr>
<td>データ1-1</td>
<td>データ1-2</td>
<td>データ1-3</td>
</tr>
<tr>
<td>データ2-1</td>
<td>データ2-2</td>
<td>データ2-3</td>
</tr>
<tr>
<td>データ3-1</td>
<td>データ3-2</td>
<td>データ3-3</td>
</tr>
</table>

</body>
</html>

表示例
見出し1 見出し2 見出し3
データ1-1 データ1-2 データ1-3
データ2-1 データ2-2 データ2-3
データ3-1 データ3-2 データ3-3