CSS empty-cells attribute

Definition and usage

The empty-cells attribute sets whether empty cells in the table are displayed (only used in "separate borders" mode).

Note:Some versions of the IE browser do not support this attribute.

Description

This attribute defines how table cells that do not contain any content are represented. If displayed, the cell borders and background will be drawn. This attribute will be ignored unless the border-collapse is set to separate.

See also:

CSS Tutorial:CSS Tables

HTML DOM Reference Manual:emptyCells attribute

Example

Hide the borders and background on empty cells in the table:

table
  {
  border-collapse:separate;
  empty-cells:hide;
  }

Try it yourself

CSS syntax

empty-cells: show|hide|initial|inherit;

Attribute value

Value Description
hide Do not draw a border around the empty cells.
show Draw a border around the empty cells. Default.
inherit The value of the empty-cells attribute should be inherited from the parent element.

Technical details

Default value: show
Inheritance: yes
Version: CSS2
JavaScript syntax: object.style.emptyCells="hide"

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome IE / Edge Firefox Safari Opera
1.0 8.0 1.0 1.2 4.0

Note:If the !DOCTYPE has been specified, Internet Explorer 8 (and higher versions) support the empty-cells attribute.