Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Type selector – CSS

Demo

Summary

To select a single type of HTML element in CSS, just use the element symbol without any angle brackets.

p {
 /* Insert code here */
}

Details

The type selector will select all elements that match the type. In the example above, all paragraph elements would be selected in the HTML file (assuming there is more than one paragraph element in the HTML file).

Here are some more examples of type selectors:

/* Select all h1 elements */
h1 {

}

/* Select all ol elements */
ol {

}

/* Select all ul elements */
ul {

}

/* Select all a elements */
a {

}

Exercises

First, recreate the CSS code from the Demo section in your CSS file.

References

Type selectors on MDN

Back to: CSS Reference > CSS Selectors