<?xml version="1.0" encoding="utf-8"?>

Applying the same CSS rules to multiple elements

Applying the same CSS rules to multiple elements Bad Practice
Applying the same CSS rules to multiple elements Best Practice

In the style sheets, there are often elements using the same CSS rules. Let's say you want to apply the color red to all <h1>, <h2>, and <p> elements. To minimize the code, you can group selectors by typing them, separated with a comma:

h1, h2, p {

color: red;

}

Pro Tip: Some consider this syntax to be a combinator selector "or."

Improve your UX & Product skills with interactive courses that actually work