Grouping Selectors
Sometimes we need to apply the same style to multiple elements that have nothing in common. They are not the same element, don't have the same class, and don't share a common attribute. In such cases, grouping selectors come in handy. We can achieve this by separating the elements with a comma. For example:
.group,
p {
color: purple;
}
This code selects both elements with the class group
and p
elements and sets their color to purple (color: purple
).
Instructions
Create a rule for both h1
and h2
elements with the following declaration: text-transform: uppercase
.
Start programming for free
9/12