empty-cells (CSS property)
Example
This style rule hides empty cells in the
table element with the ID "results":
#results {
empty-cells: hide;
}
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
visibilityproperty is set tohidden.
A non-breaking space is considered to be visible content.
Value
show- The value
showmeans borders will be drawn around empty cells, and backgrounds will be drawn behind them. hide- The value
hidemeans that no borders or backgrounds will display empty cells. If all the cells in a row have this setting forempty-cells, and none of them have any visible content, the entire row will behave as if it haddisplay:none.
Compatibility
| IE | 5.5 | None |
|---|---|---|
| 6.0 | None | |
| 7.0 | None | |
| Firefox | 1.0 | Buggy |
| 1.5 | Buggy | |
| 2.0 | Buggy | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Buggy |
| 9.5 | 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.
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.

