caption‑side CSS Property Demo - Online Table Caption Position
Place a table caption on top, bottom, or inline‑start/end. See the live change. Copy the code.
UD5 Toolkit
empty-cells Property DemoInteractive demonstration of how empty-cells controls the visibility of empty table cell borders and backgrounds. Edit cells, toggle modes, and see the real-time difference between show and hide.
| Name | Math | English | Science |
|---|---|---|---|
| Alice | 85 | 92 | |
| Bob | 78 | 88 | |
| Charlie | 90 | ||
| Diana | 76 | 85 | 91 |
| Name | Math | English | Science |
|---|---|---|---|
| Alice | 85 | 92 | |
| Bob | 78 | 88 | |
| Charlie | 90 | ||
| Diana | 76 | 85 | 91 |
/* Table with empty-cells: show (default) */
table {
empty-cells: show;
border-collapse: separate;
border-spacing: 6px;
}
/* Table with empty-cells: hide */
table {
empty-cells: hide;
border-collapse: separate;
border-spacing: 6px;
}
empty-cells property only works with border-collapse: separate (the default).
When border-collapse: collapse is active, empty-cells has no effect — both tables will look identical.
Toggle the "Collapse Borders" switch above to see this in action. Also note: a cell containing or any whitespace is not considered empty.
The empty-cells CSS property controls whether borders and backgrounds are rendered around empty table cells (cells with no visible content). It applies to <td> and <th> elements within a table that uses border-collapse: separate. This property is part of the CSS 2.1 specification and is supported by all modern browsers.
It accepts two keyword values:
show (default) — Empty cells display their borders and backgrounds normally, just like filled cells.hide — Empty cells' borders and backgrounds are completely hidden, making the cell appear invisible (though it still occupies space in the layout).A cell is considered empty only if it contains absolutely no content — no text, no child elements, no , and no whitespace characters (including spaces and line breaks). Even a single or a zero-width space makes the cell "non-empty," and empty-cells: hide will not hide it. The browser checks the cell's inner content; if textContent.trim() is '', it's empty.
No. The empty-cells property only takes effect when border-collapse: separate is set (which is the default for HTML tables). In collapse mode, borders are merged into a single border between adjacent cells, and the concept of individual cell borders doesn't apply — so empty-cells is ignored entirely. Use the toggle switch in the demo above to verify this behavior.
Use the CSS declaration empty-cells: hide; on your <table> element, and ensure border-collapse: separate; is active. For even more control, you could use JavaScript to detect empty cells and apply visibility: hidden; or remove them from the DOM entirely. However, empty-cells: hide is the simplest, native CSS solution for hiding borders and backgrounds of empty cells while preserving table structure.
Common scenarios include:
empty-cells has excellent browser support. It is supported in all major browsers including Chrome, Firefox, Safari, Edge, and Opera — going back to IE8+. It's a stable CSS 2.1 feature that you can safely use in production without vendor prefixes or fallbacks.
No. empty-cells is a discrete property — it only accepts keyword values (show or hide) with no intermediate states, so CSS transitions and animations cannot interpolate between them. The change is instantaneous. If you need a smooth fade effect for hiding empty cells, you would need to use JavaScript with opacity or visibility transitions instead.
Place a table caption on top, bottom, or inline‑start/end. See the live change. Copy the code.
Enter a list of component props with types and defaults, and get a Markdown table ready for your Readme or Storybook.
Reduce your HTML file size by stripping whitespace, comments, and optional closing tags. Secure browser‑based.
See how <datalist> works across browsers. Test with many options. Copy the minimal markup. Simple native autocomplete.
Check if your site has a service worker registered and if it can load offline. Quick PWA readiness assessment.
Play white, pink, or brown noise to aid focus, sleep, or tinnitus relief. Infinite loop and volume control. Works in background; no downloads.
Generate continuous white, pink, or brown noise for sleep or concentration. Adjustable volume with offline support via Web Audio API. No downloads needed.
Read and write NDEF records to NFC tags using the Web NFC API. Supports text, URL, and MIME records. Works on Android with Chrome.
Paste any text and have it read aloud while each spoken word is highlighted. Improve reading focus. Web Speech API.
Paste a sentence and see each word tagged with its part of speech (noun, verb, adjective). Local rule‑based analysis.
Paste or type text and have it read aloud with natural voices. Control speed and pitch. Uses browser's built‑in TTS.
Create complex linear gradients with any number of color stops, exact angles, and length units. Live preview and CSS code.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Design a fully styled scrollbar with colors, width, radius, and hover effects. Supports both ::-webkit‑scrollbar and Firefox scrollbar‑width.
Create CSS clamp() values for fluid typography. Enter min and max font sizes and viewport widths. Modern responsive design.
Create CSS mask‑image effects with custom shapes, gradients, and SVGs. Visually see the mask applied to an image. Copy the CSS.
Paste your CSS and sort the properties of each rule alphabetically or by concentric groups. Keep your stylesheets consistent without a build step.
Create a customizable checkerboard or grid background using pure CSS gradients. Adjust cell size and colors. Copy the code.
Paste an HTML `<table>` snippet and instantly get a clean Markdown table. Supports colspan and alignment hints. Local.
Upload two images and apply CSS blend modes (multiply, screen, overlay, etc.). See the result and copy the filter CSS. Pure frontend.
Add print styles like removing backgrounds, adding page breaks, setting margins. See print preview instantly.
Enter rows of data and create a nicely formatted ASCII table using box‑drawing characters. Great for CLI apps.
Write a media query and instantly see if it matches your current viewport. Width, height, orientation, and more.
Paste your CSS and strip all `!important` declarations in one click. See a list of affected rules. Local tool.
Paste HTML/CSS snippets or enter properties to test how z‑index and stacking contexts interact. Real‑time example.
Design a pure CSS tooltip with custom text, position (top/bottom/left/right), and arrow. Copy the clean code.
Fetch a website's CSS and extract :root custom properties (‑‑color) to reveal its design token palette. For learning and inspiration.
Find safe mixing ratios for the classic elephant toothpaste demonstration. Volume adjustments for different container sizes.
Create and format Markdown tables by adjusting rows and columns. Align text, copy the raw Markdown. Perfect for README files.
Recreate the target CSS linear gradient by adjusting stops and colors. A unique game for front‑end developers to master gradients.