Skip to: content, navigation

empty-cells (CSS property)

Spec
Inherited Initial Version
Yes show CSS2
Browser support (more…)
IE7 FF1+ SA1.3+ OP9.2+
None Buggy Full Buggy

Syntax

empty-cells: { hide | show | inherit } ;

Description

This property controls the rendering of the borders and backgrounds of cells that have no visible content in a table that’s using the separated borders model. If the collapsing model is used, this property is ignored.

The property applies only to elements whose display property has the value table-cell, but since it’s inherited, it can also be set on the whole table, a row group, or a row.

A cell is considered to have no visible content if any of the following cases apply:

  • It has no content at all.
  • It contains only carriage returns, line feeds, tab characters, or blank spaces.
  • Its visibility property is set to hidden.

A non-breaking space is considered to be visible content.

Example

This style rule hides empty cells in the table element with the ID "results":

#results {
  empty-cells: hide;
}

Value

show
The value show means borders will be drawn around empty cells, and backgrounds will be drawn behind them.
hide
The value hide means that no borders or backgrounds will display empty cells. If all the cells in a row have this setting for empty-cells, and none of them have any visible content, the entire row will behave as if it had display:none.

Compatibility

Internet Explorer Firefox Safari Opera
5.5 6.0 7.0 1.0 1.5 2.0 1.3 2.0 3.0 9.2 9.5
None None None Buggy Buggy Buggy Full Full Full Buggy Buggy

Internet Explorer for Windows versions up to and including 7 don’t support this property, and will behave as if all tables had empty-cells set to hide.

Firefox versions up to and including 2 don’t hide the row if all the cells have empty-cells:hide and none of them have any visible content.

Opera versions up to and including 9.5 won’t hide the row, and will display cell backgrounds, if empty-cells:hide is applied to all the cells, and none of them have any visible content.

User-contributed notes

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

Search