Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Select a child – CSS



To select an immediate child of an HTML element, use 2 selectors separated by a greater than sign (the first selector represents the parent element and the second selector represents the immediate child):

.my-class > p {



The child combinator will only select elements that are immediate children of the parent element that match the selector specified.


Recreate the CSS code from the Demo section in your CSS file.


Child combinator on MDN

Back to: CSS Reference > CSS Selectors