From the course: CSS: Selectors

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Selector lists

Selector lists - CSS Tutorial

From the course: CSS: Selectors

Start my 1-month free trial

Selector lists

- [Instructor] Finally, it's likely you're already familiar with group selectors. These are selectors that are separated by commas, but with only one set of styles. In this example we have an H1, an H2, and an H3 listed here as our selector separated by commas. This is read as for all H1s, H2s, or H3s style in the following way. Any one of these HTML elements will be styled in the same way. You can think of this as an or statement in programming. The styles apply for all of these HTML elements. Group selectors aren't limited to elements though. You can mix the selector types as this example shows. Here we're applying one set of styling to a class and to an ID. A common mistake made when working with group selectors is to assume that the styling carries through to other elements in the group. Consider this example. Here we have a selector where all unvisited links descended from a class of warning have a certain style, but what if we want to include visited links descended from a class…

Contents