Type selectors

The most common and easy to understand selectors are type selectors. Type selectors will select any HTML element on a page that matches the selector, regardless of their position in the document tree. For example:

em {color: blue; }

This rule will select any <em> element on the page and color it blue. As you can see from the document tree diagram below, all <em> elements will be colored blue, regardless of their position in the document tree.

Document tree showing type selector

There are a huge range of elements that you can select using type selectors, which means you can change the appearance of any or every element on your page using only type selectors.

For the full list of HTML elements - almost all of which can be styled - see the W3C's Index of HTML Elements.

Type selectors are well supported across standards-compliant browsers.

Further information

Class selectors »

Other Max Design articles and presentations
Associated with webstandardsgroup.org