CSS Child (>) Combinator
Example
Select and style every <p> element that are direct children of a <div> element:
div > p
{
background-color: gold;
border: 1px solid gray;
}
Try it Yourself »
Definition and Usage
The CSS child combinator (>
) is used to select elements that are direct children
of a specific parent.
Elements matched by the second selector must be the immediate children of the elements matched by the first selector.
Note: Elements that are not direct children of the specified parent, are not selected.
Version: | CSS2 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the combinator.
Combinator | |||||
---|---|---|---|---|---|
element1 > element2 | Yes | 7.0 | Yes | Yes | Yes |
CSS Syntax