CSS

CSS

🎯 CSS empty-cells Property

The empty-cells CSS property controls the visibility of empty table cells in an HTML table.

It determines whether empty <td> or <th> elements are shown or hidden in a table layout.

🔹 Why Use empty-cells?

This property helps control the visual structure of tables, especially when some cells have no content.

  • Improves table appearance
  • Removes unwanted empty cell borders
  • Helps clean UI design
  • Useful in dynamic tables

🧩 empty-cells Values

1️⃣ show (Default)

Empty cells are visible and displayed normally with borders.

CSS

table {
    empty-cells: show;
}
                

This is the default behavior of tables in most browsers.

2️⃣ hide

Empty cells are hidden from view, including their borders.

CSS

table {
    empty-cells: hide;
}
                

This is useful when you want a cleaner table appearance.

3️⃣ initial

Resets the property to its default value (show).

4️⃣ inherit

Inherits the value from the parent element.

📌 Quick Summary

  • 🧠 Overview

  • show → displays empty cells (default)
  • hide → hides empty cells completely
  • initial → resets to default value
  • inherit → takes value from parent element