There's an important difference between :is() and :where().

Let's take the following example. We have two buttons and we use :where() on the first button to apply a background color and :is() on the second button.

<button class="button1">where</button>
<button class="button2">is</button>
button:where(.button1) {
  background-color: rebeccapurple;
}

button:is(.button2) {
  background-color: rebeccapurple;
}

Visually the buttons are identical, but the difference is the specificity of the selector.

The button with the :where() pseudo-class has the same specificity as a simple tag selector (for example button {}) because the specificity of :where() is 0. The arguments in :where() don't add to the specificity of the selector.

The button with the :is() pseudo-class has the same specificty as a combined selector (for example button.button2 {}) because :is() takes on the specificity of the most specific selector in its arguments.


/* Specificity: 0 0 1 (0 ids, 0 classes, 1 tag) */
button:where(.button1) {
  background-color: rebeccapurple;
}

/* Specificity: 0 1 1 */
button:is(.button2) {
  background-color: rebeccapurple;
}

/* Specificity: 0 0 1 
  -> Same as the first button. Overwrites rebeccapurple.
  -> Lower than the second button. Doesn't overwrite rebeccapurple.
*/
button {
  background-color: salmon;
}

/* Specificity: 0 1 0
  -> Still lower than the second button. Doesn't overwrite rebeccapurple.
*/
.button2 {
  background-color: green;
}

My blog doesn't support comments yet, but you can reply via blog@matuzo.at.