Learn
Selectors
Type selectors
The Type Selector selects HTML elements based on their tag name. For example, if you want to select all the paragraphs on the page, you can use the Type Selector p
.
Here's an example of how to use the Type Selector to set the color of all the paragraphs to red:
Instructions
1.
Open style.css
. Inside it, add a ruleset using the type selector to target all <h2>
elements. Leave the declaration block ({ }
) empty for now.
2.
Inside the curly braces of the h2 selector, add the declaration below:
Note that the content of the web page will update because we've already linked style.css to index.html.
Sign up to start coding
Already have an account?
Sign In
Course content