Applying the same CSS rules to multiple elements
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."