CSS Descendant ( ) Combinator
Example
Select and style all <p> elements inside <div> elements:
div p
{
background-color: yellow;
}
Try it Yourself »
Definition and Usage
The descendant combinator (a single space
) is used to
select elements inside elements.
Elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc.) element matching the first selector.
Version: | CSS1 |
---|
Browser Support
Combinator | |||||
---|---|---|---|---|---|
element1 element2 | Yes | Yes | Yes | Yes | Yes |
CSS Syntax