×

css · level 3 · unit 2 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

matches like :is(), but weighs nothing.

:where() works like :is(): it matches any selector in its brackets. The difference is weight. Whatever you put inside, :where() adds zero specificity, so the rule counts as if that part were not there.

That makes it perfect for a , the small set of rules at the top of a stylesheet that clears the browser's own styles. A reset should set starting points that a later rule with one class can change.

Libraries shared by many teams wrap their selectors in :where() for the same reason: your own rules win without a fight.

<ul class="menu">
  <li>Home</li>
  <li>Shop</li>
</ul>
:where(ul, ol) {
  margin: 0;
  padding: 0;
}
.menu {
  padding: 12px;
  background-color: #f4a261;
}

Press show my page to see it here.