Little Web Hut

CSS 2.1 Reference: empty-cells Property

CSS empty-cells Property
Syntax
selector {empty-cells: value;}
  • value is specified by using one of the following keywords: show, hide, or inherit.
Usage

The empty-cells property is used with tables to control whether the border and background for empty cells should be displayed. This property applies to tables that have a border-collapse property value of separate.

This property is specified by using a keyword according to the syntax shown above.


CSS Example: The empty-cells properties are set to show and hide.
  #tst1 {empty-cells: show;}
  #tst2 {empty-cells: hide;}
  th, td {border: thin solid;
          background-color: yellow;
  }
  table {display: table;
         border-collapse: separate;
         border-spacing: 5px;
         background-color: lime;
         border: thin solid;
         width: 400px;
         margin: 10px;
  }
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • show - Borders and background for empty table cells are displayed.
  • hide - Borders and background for empty table cells are hidden.
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To Elements that have a display property value of table-cell.
Inherited Yes
Initial Value show


empty-cells Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe empty-cells properties are set to show and hide.