Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

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 Course > CSS Selectors