Cyber Code Academy
Tutorials Academy Courses
Home / CSS / CSS Combinators

CSS Combinators

Descendant selector

.article p { line-height: 1.7; }

Selects paragraphs anywhere inside an article.

Child selector

.menu > li { list-style: none; }

Selects only direct list-item children.

Sibling selectors

h2 + p { margin-top: 0; }
h2 ~ p { color: #475569; }

+ selects the immediately following sibling. ~ selects following siblings sharing the same parent.

Practice

Style only direct child list items in a navigation menu.

Want to learn this professionally?

Explore practical IT training at Cyber Code Academy.

View Academy Courses