Home » Tutorials empty property Tutorials Author admin Reading 1 min Views 443 Published by September 15, 2011 Modified by August 22, 2024 Contents Definition and UsageSyntaxExamplesCompatibilityDesktop browsersMobile browsersDefinition and Usage The :empty pseudo-class represents any element that has no children at all. Only element nodes and text (including whitespace) are considered. Comments or processing instructions do not affect whether an element is considered empty or not. Syntax <element>:empty { style properties } Examples 1 .box { 2 background: red; 3 height: 200px; 4 width: 200px; 5 } 6 .box:empty { 7 background: lime; 8 } 1 <div class="box"><!-- I will be lime --></div> 2 <div class="box">I will be red</div> Compatibility Desktop browsers Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari Basic support 1.0 1.0 (1.7 or earlier) 9.0 9.5 3.1 Mobile browsers Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Basic support 2.1 1.0 (1) 9.5 10.0 3.1