CSS: selector list (grouping selectors)

By Xah Lee. Date: . Last updated: .

Selector List (Grouping Selectors)

This allows you to specify multiple selectors together.

they act like “logical or”.

s1, s2, etc

Match any selector expression s1, s2, etc.

s1, s2, s3 {abc}

is the same as

s1 {abc} s2 {abc} s3 {abc}

Each of the s can be a Compound Selector expression.

/* 
make red of all div of class x, or any span:
*/
div.x, span {
 color: red;
}

/* same as */

div.x {
 color: red;
}
span {
 color: red;
}

CSS, Selectors