--- title: empty-cells slug: Web/CSS/empty-cells tags: - CSS - CSS プロパティ - CSS 表 - リファレンス translation_of: Web/CSS/empty-cells ---
CSS の empty-cells プロパティは、目に見える内容を持たない{{htmlelement("table", "表")}}のセルの、周囲の境界と背景を{{glossary("user agent", "ユーザーエージェント")}}がどのように描画するかを指定します。
この対話型サンプルのソースファイルは GitHub リポジトリに格納されています。対話型サンプルプロジェクトに協力したい場合は、 https://github.com/mdn/interactive-examples をクローンしてプルリクエストを送信してください。
このプロパティは、 {{cssxref("border-collapse")}} プロパティが separate の場合のみ効果があります。
/* キーワード値 */ empty-cells: show; empty-cells: hide; /* グローバル値 */ empty-cells: inherit; empty-cells: initial; empty-cells: unset;
empty-cells プロパティは、以下のキーワード値のうちの一つで指定します。
showhide<table class="table_1">
<tr>
<td>Moe</td>
<td>Larry</td>
</tr>
<tr>
<td>Curly</td>
<td></td>
</tr>
</table>
<br>
<table class="table_2">
<tr>
<td>Moe</td>
<td>Larry</td>
</tr>
<tr>
<td>Curly</td>
<td></td>
</tr>
</table>
.table_1 {
empty-cells: show;
}
.table_2 {
empty-cells: hide;
}
td,
th {
border: 1px solid gray;
padding: 0.5rem;
}
{{ EmbedLiveSample('Examples', '100%', '200') }}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS2.1', 'tables.html#empty-cells', 'empty-cells')}} | {{Spec2('CSS2.1')}} |
{{cssinfo}}
このページの互換性一覧表は構造化データから生成されています。データに協力したいのであれば、 https://github.com/mdn/browser-compat-data をチェックアウトしてプルリクエストを送信してください。
{{Compat("css.properties.empty-cells")}}