Skip to Content
Learning Web Design, 5th Edition
book

Learning Web Design, 5th Edition

by Jennifer Robbins
May 2018
Beginner content levelBeginner
808 pages
25h 3m
English
O'Reilly Media, Inc.
Content preview from Learning Web Design, 5th Edition

C. CSS Selectors, Levels 3 and 4

C

CSS Selectors, Levels 3 and 4

The following table lists the selectors in the Selectors Level 4 Editor’s Draft (, December 2017).

Note that selectors marked “(Level 4)” are new and may not yet be implemented by browsers. Check and be sure to test well if you use them. All other selectors are part of CSS3 and are generally well supported.

Selector

Type of selector

Description

Simple selectors and combinators

*

Universal selector

Matches any element.

A

Type selector

Matches the name of an element.

A, B

Compound selector

Matches elements A and B.

A B

Descendant combinator

Matches element B only if it is a descendant of element A.

A>B

Child combinator

Matches any element B that is a child of element A.

A+B

Next-sibling combinator

Matches any element B that immediately follows any element A, where A and B share the same parent.

A~B

Subsequent-sibling combinator

Matches any element B that is preceded by A, where A and B share the same parent.

Class and ID selectors

.classname A.classname

Class selector

Matches the value of the class attribute in all elements or in a specified element.

#idname A#idname

ID selector

Matches the value of the id attribute in an element.

Attribute selectors

A[att]

Simple attribute selector

Matches any element A that has the given attribute defined, whatever its value. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Web Design, 4th Edition

Learning Web Design, 4th Edition

Jennifer Robbins

Publisher Resources

ISBN: 9781491960196Errata Page