Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | :empty Selector

Improve Article
Save Article
Like Article
  • Last Updated : 11 Jul, 2022
Improve Article
Save Article
Like Article

The :empty selector is used to select that element which does not contain any children (including text node). 


:empty {
    // CSS property



<!DOCTYPE html>
        <title>empty selector</title>
            h1 {
            div:empty {
                width: 150px;
                height: 20px;
                background: green;
            <h2>:empty selector</h2>
            <div>A computer science portal for geeks</div>



Supported Browsers: The browser supported by :empty selector are listed below:

  • Apple Safari 3.1 and above
  • Google Chrome 1.0 and above
  • Edge 12.0  and above
  • Firefox 1.0 and above
  • Opera 9.5 and above
  • Internet Explorer 9.0 and above
My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!