CSS Selector :empty

Description

The :empty selector matches elements with no children.

Example


<!DOCTYPE HTML> 
<html> 
    <head> 
        <style type="text/css"> 
        :empty { <!--  w  w  w .j av a  2 s . c  om-->
            border: thin black solid; 
            padding: 4px; 
        } 
        </style> 
    </head> 
    <body> 
        <a href="http://java2s.com">Visit the java2s.com</a> 
        <a href="http://w3c.org">Visit the W3C website</a> 
    </body> 
</html>

Click to view the demo

The code above generates the following result.

:empty




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference