Skip to content
Related Articles

Related Articles

Improve Article

CSS | :empty Selector

  • Last Updated : 04 Dec, 2018
Geek Week

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.2
  • Google Chrome 4.0
  • Firefox 3.5
  • Opera 9.6
  • Internet Explorer 9.0

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :