CSS empty-cells 属性
隐藏表中的空单元格的边框和背景:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
table {
border-collapse: separate;
empty-cells: hide;
}
</style>
</head>
<body>
<table border="1">
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td></td>
</tr>
</table>
<p><b>注意:</b> 当 !DOCTYPE 已经声明 Internet Explorer 8 支持 empty-cells属性.</p>
</body>
</html>
属性定义及使用说明
empty-cells 属性设置是否显示表格中的空单元格(仅用于"分离边框"模式)。
默认值: | show |
---|---|
继承: | yes |
版本: | CSS2 |
JavaScript 语法: | object.style.emptyCells="hide" |
浏览器支持
所有主流浏览器都支持empty-cells属性。
注意:只有指定!DOCTYPE,IE8才支持empty-cells属性。
属性值
值 | 描述 |
---|---|
hide | 不在空单元格周围绘制边框。 |
show | 在空单元格周围绘制边框。默认。 |
inherit | 规定应该从父元素继承 empty-cells 属性的值。 |
相关文章
CSS 教程: CSS Table