CSS Child Combinator (>) Selector
Description
The child combinator (>) selector, commonly known as the child combinator, is a CSS selector used to target elements that are direct children of a specified parent element. Unlike the descendant combinator (a space), which selects elements nested at any depth, the > selector ensures that only elements immediately nested inside a parent are matched. This allows for precise styling when the structure of your HTML requires differentiation between levels of nested elements.
For example, consider a structure with multiple levels of nesting:
<ul>
<li>Item 1</li>
<li>
Item 2
<ul>
<li>Subitem 2a</li>
</ul>
</li>
</ul>
Using the selector ul > li, only the top-level <li> elements (Item 1 and Item 2) would be targeted. The <li> nested inside the second <li> (Subitem 2a) would not be selected because it is not a direct child of the <ul> but rather a grandchild. This illustrates the specificity and control offered by the > selector.
The child combinator (>) selector can be particularly useful when combined with other selectors for more targeted styling. For example, combining it with class selectors allows you to apply rules only to certain child elements without affecting deeper nested structures. It can also be used with pseudo-classes like :nth-child() to style elements based on their position within a parent.
Another common use is in styling nested div elements where you want a parent container to affect only its immediate child div blocks. For instance:
.container > div {
padding: 10px;
border: 1px solid #ccc;
}
Here, only the direct <div> children of .container are styled, preventing unintended styles from cascading to deeper nested <div> elements. This makes the > selector a powerful tool for maintaining structured and predictable layouts, especially in complex HTML hierarchies.
The child combinator (>) selector is also essential in modular component design, where you might want to isolate styles within a parent component without affecting nested subcomponents or children that belong to other modules.
Syntax
element > element { css declarations; }
Example
Browser Support
The following information will show you the current browser support for the CSS Child Combinator (>) selector. Hover over a browser icon to see the version that first introduced support for this selector.
This CSS child combinator (>) selector is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 3rd January 2026
