CSS Selectors

Extended Notes

Multiple Selectors

With , we can apply styles to multiple selectors at the same time. Just as a quick example, which you may see in different reset CSS files; the code below selects both <html> and <body> and describes the margins to be 0 each.

html,
body {
  margin: 0;
}

Also you can join more selectors (more than just 2).

Combinators

Combinators are great tools to create complex CSS styles, otherwise most things will have a fairly static style through the lifetime of the page, which can be not cool... Oh well. Actually, the multiple selectors mentioned above can be categorized as a type of combinators; there are a few more that come handy.

References