CSS child combinator (>)
- Previous Page Child Combinator
- Next Page Descendant Combinator
- Go Up One Level CSS Combinator Reference Manual
Definition and Usage
CSS Child Element Combinator (>
) is used to select elements that are direct children of a specific parent element.
The element matched by the second selector must be a direct child of the element matched by the first selector.
Note:Elements that are not direct children of the specified parent element will not be selected.
Example
Set the style for each <p> element that is a direct child of the <div> element by selecting and setting it:
div > p { background-color: gold; border: 1px solid gray; }
CSS Syntax
element1 > element2 { css declarations; }
Technical Details
Version: | CSS2 |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports the combination.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Support | 7.0 | Support | Support | Support |
Related Pages
CSS Tutorial:CSS child selector
- Previous Page Child Combinator
- Next Page Descendant Combinator
- Go Up One Level CSS Combinator Reference Manual