1. Technology

What is a CSS Type Selector?


A CSS type selector names the HTML tag or XHTML element to style. To use a type selector, simply write the HTML tag name that you want styled.

To style all paragraph (P) tags, you would write:

p {
color : green ;

To style all h1 tags, you would write:

h1 {
font-size : 1.2em ;

If you have two XHTML tags that need the same style, separate the selectors with a comma:

p, h1, h2 {
font-family : Geneva, Arial, Helvetica, sans-serif ;

©2014 About.com. All rights reserved.