[CSS Selector] E > F
Using '>' applies styles only to direct child elements of the specified element.
Sample Code
div.hoge > div { color: red;} /* Applies only to elements that are direct children of a div element with the class name 'hoge'. */
div { color: blue;}
Browser Display Result
div.hoge > div { color: red;} /* Applies only to elements that are direct children of a div element with the class name 'hoge'. */
div { color: blue;}
<div class="hoge"> <div>This is a div element inside a div element with the class name 'hoge'.</div> <div> <div>This is a div element inside a div element inside a div element with the class name 'hoge'. Since it is not a direct child of 'div.hoge', the text color does not become red.</div> </div> </div>
Browser Compatibility
Desktop
Supported in all versions
8 ○
7 ○
6 ×
3 and earlier ×Mobile
Android Browser
4.4+ ○
3 and earlier ×Same support as desktop
Same support as desktop
※ Version data is based on MDN.
If you find any errors or copyright issues, please contact us.