To add a background color to paragraph element who has no children, we can use the following rule with :empty pseudo class. HTML
Just
Another world! CSS p:empty {
width: 100px;
height: 20px;
background: whitesmoke;
} Output