CSS empty-cells 属性的使用

javascriptweb developmentfront end scripts更新于 2024/7/28 4:28:00

empty-cells 属性指定单元格为空时是否显示边框。它指示没有任何内容的单元格是否应显示边框。

示例

此属性可以具有以下三个值之一:show、hide 或 inherit。

<html>
   <head>
      <style>
         table.empty{
            width:400px;
            border-collapse:separate;
            empty-cells:hide;
         }
         td.empty{
            padding:5px;
            border-style:solid;
            border-width:1px;
            border-color:#999999;
         }
      </style>
   </head>
   <body>
      <table class = "empty">
         <tr>
            <th></th>
            <th>Title one</th>
            <th>Title two</th>
         </tr>
         <tr>
            <th>Row Title</th>
            <td class = "empty">R1T1</td>
            <td class = "empty">R1T2</td>
         </tr>
         <tr>
            <th>Row Title</th>
            <td class = "empty">R2T1</td>
            <td class = "empty"></td>
         </tr>
      </table>
   </body>
</html>

相关文章