Skip to: content, navigation

by Tommy Olsson and Paul O’Brien with contributors

empty-cells (CSS property)

Browser support full matrix
IE7 FF1+ Saf1.3+ Op9.2+
None Buggy Full Buggy
Spec
Inherited Initial Version
Yes show CSS2

Example

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

#results {
  empty-cells: hide;
}

Try it yourself!View all demos

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.

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

IE5.5None
6.0None
7.0None
Firefox1.0Buggy
1.5Buggy
2.0Buggy
Safari1.3Full
2.0Full
3.0Full
Opera9.2Buggy
9.5Buggy

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.

Related Reading

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

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters