0% found this document useful (0 votes)
88 views1 page

Css Combinator

CSS combinators define the relationship between selectors and there are four types: descendant, child, adjacent sibling, and general sibling. The descendant selector matches all descendant elements, the child selector only direct children, adjacent sibling matches the next sibling element, and general sibling any subsequent sibling element. For example, the descendant selector 'div p' would select all <p> elements inside <div> elements.

Uploaded by

Alex Mociran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views1 page

Css Combinator

CSS combinators define the relationship between selectors and there are four types: descendant, child, adjacent sibling, and general sibling. The descendant selector matches all descendant elements, the child selector only direct children, adjacent sibling matches the next sibling element, and general sibling any subsequent sibling element. For example, the descendant selector 'div p' would select all <p> elements inside <div> elements.

Uploaded by

Alex Mociran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

CSS Combinators

CSS Combinators
A combinator is something that explains the relationship between the selectors.

A CSS selector can contain more than one simple selector. Between the simple
selectors, we can include a combinator.
There are four different combinators in CSS3:

descendant selector (space)

child selector (>)

adjacent sibling selector (+)

general sibling selector (~)

Descendant Selector
The descendant selector matches all elements that are descendants of a
specified element.
The following example selects all <p> elements inside <div> elements:

Example
div p {
background-color: yellow;
}

You might also like