Selector Combinations
Let’s dig into the details of strategies for targeting HTML elements.
We'll cover the following
Selecting multiple elements
To select multiple elements, separate the selectors by commas:
/* Selecting multiple HTML element types */
h1, p {
border: 1px solid black;
}
/* Selecting styles to be applied to several classes */
.ingredientsList, .instructionsList {
font-size: 1.2em;
}
/* Using multiple kinds of selectors*/
h3, .red, #redElement{
color: red;
}
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy