bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/CSS/Reference and Practice
CSS•Reference and Practice

CSS Combinators Reference

Concept visual

CSS Combinators Reference

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

CSS Combinators

A combinator is a sign that explains the relationship between selectors. The table below shows the different combinators in CSS:

Name

Sign

Example

Example Result

Child combinator

>

Formula

div > p
Selects every < p > element that are direct children of a < div > element

Descendant combinator

(single space) div p

Formula

Selects all < p > elements inside < div > elements

Namespace separator

| ns | h2

Formula

Selects all < h2 > elements in namespace ns

Next-sibling combinator

+

Formula

div + p
Selects the first < p > element that is placed immediately after < div > elements

Selector list, div, p

Formula

Selects all < div > elements and all < p > elements

Subsequent-sibling combinator

~ p ~ ul

Formula

Selects all < ul > elements that are preceded by a < p > element

Previous

CSS Online Editor

Next

CSS Snippets