Empty Cells Property

Last updated: 2026-09-13

empty-cells Empty Cells Property

empty-cells controls whether empty cells (cells with no content or only whitespace) show their borders and background. The default show renders them normally; hide hides them for a cleaner look. The property only applies to tables with border-collapse: separate.

Category
Initial Valueshow
InheritedYes
Applies To
Animation Type
CSS VersionCSS2
StatusStandard

📝 Syntax

empty-cells: show | hide;

⚙️ Values

ValueTypeDescription
show | hideKeywordEmpty cell borders

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
empty-cells v1 v12 v1 v1 v1
Supported in all major browsers
Tip: empty-cells requires border-collapse: separate; it has no effect with border-collapse: collapse.

❓ FAQ

QHow do show and hide affect a table's appearance?
Ashow (the default): empty cells keep their borders and background, so the grid stays complete and continuous. hide: the borders and background of empty cells disappear, creating visual 'holes' that look cleaner and suit sparse data. Note that hide only removes borders and background — the cell itself and its width still occupy space, so layout is unaffected.
QWhy doesn't empty-cells: hide have any effect?
ACheck whether border-collapse is separate. empty-cells only works with border-collapse: separate (the default); if the table sets border-collapse: collapse, the property is ignored. This is the most common cause of failure — switch to separate and it works.
QWhat is the browser support for empty-cells?
ASupport is excellent — every mainstream browser, including IE, supports it; it is a CSS 2.1 property. The only caveat is that it needs border-collapse: separate. Confirm the table's border-collapse state and no prefix is needed.
QHow do I tell whether a cell is 'empty'?
AAn empty cell has no content or only whitespace (spaces, newlines). Note that   (non-breaking space) counts as content, so empty-cells: hide will not apply; a cell containing a child element (even an empty div) is not empty either. To force-hide such 'pseudo-empty' cells, clean up the whitespace inside them first.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏