CSS emptycells Property (original) (raw)

CSS empty-cells Property

Last Updated : 22 May, 2026

The empty-cells property in CSS is used to control the visibility of borders and backgrounds in empty table cells. It helps improve the appearance and formatting of HTML tables.

**Syntax:

empty-cells: show | hide | initial | inherit;

**Default Value: show

**Property values:

**Example: Here, we are using empty-cell: show property.

html `

empty-cell property
<style>
    table.geek {
        empty-cells: show;
    }

    td {
        text-align: center;
    }

    .gfg {
        font-size: 40px;
        font-weight: bold;
        color: green;
    }

    .geeks {
        font-size: 17px;
    }
</style>
GeeksforGeeks
A computer science portal for geeks
    <h2>empty-cells: show;</h2>
    <table class="geek" border="1">
        <tr>
            <td>C Programming</td>
            <td>C++ Programming</td>
        <tr>
            <td>Java</td>
            <td></td>
        </tr>
    </table>
</center>

`

**Example: Here, we are using empty-cell: hide property.

html `

empty-cell property
<style>
    table.geek {
        empty-cells: hide;
    }

    td {
        text-align: center;
    }

    .gfg {
        font-size: 40px;
        font-weight: bold;
        color: green;
    }

    .geeks {
        font-size: 17px;
    }
</style>
GeeksforGeeks
A computer science portal for geeks
    <h2>empty-cells: show;</h2>
    <table class="geek" border="1">
        <tr>
            <td>C Programming</td>
            <td>C++ Programming</td>                
        <tr>
            <td>Java</td>
            <td></td>
        </tr>
    </table>
</center>

`

**Example: Here, we are using empty-cell: initial property.

html `

empty-cell property
<style>
    table.geek {
        empty-cells: initial;
    }

    td {
        text-align: center;
    }

    .gfg {
        font-size: 40px;
        font-weight: bold;
        color: green;
    }

    .geeks {
        font-size: 17px;
    }
</style>
GeeksforGeeks
A computer science portal for geeks
    <h2>empty-cells: show;</h2>
    <table class="geek" border="1">
        <tr>
            <td>C Programming</td>
            <td>C++ Programming</td>                
        <tr>
            <td>Java</td>
            <td></td>
        </tr>
    </table>
</center>

`

**Example: Here, we are using empty-cell: inherit property.

html `

empty-cell property
<style>
    table.geek {
        empty-cells: initial;
    }

    .g4g {
        empty-cells: inherit;
    }

    td {
        text-align: center;
    }

    .gfg {
        font-size: 40px;
        font-weight: bold;
        color: green;
    }

    .geeks {
        font-size: 17px;
    }
</style>
GeeksforGeeks
A computer science portal for geeks
    <h2>empty-cells: show;</h2>
    <table class="geek" border="1">
        <tr>
            <td>C Programming</td>
            <td>Algorithm</td>
        </tr>
        <tr>
            <td></td>
            <td>
                <table class="g4g" border="1">
                    <tr>
                        <td>DP</td>
                        <td>Backtracking</td>
                    </tr>
                    <tr>
                        <td>Sorting</td>
                        <td></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</center>

`