Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

A, B

A selector list: one rule for several selectors separated by commas.

Syntax

A, B { … }

Examples

One set of styles for headings and a class:

<style>
  h3, h4, .subtitle { font-family: Georgia, serif; color: darkslateblue; }
</style>
 
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<p class="subtitle">A subtitle</p>

Notes

If any selector in the list is invalid, the browser drops the whole rule. :is() with the same selectors is forgiving: it skips only the broken one.

See also

  • :is() — Matches an element that matches any selector in the list — a way to shorten long selector lists.
  • tag — The type selector picks every element with the given tag; the universal selector `*` picks every element.

In the tutorial

  • Selectors — How to pick elements for styling — by tag, class, id, nesting and attribute.

Thanks for reading!

Donate to the site — we work hard for you.