1. Computing
Send to a Friend via Email

Discuss in my forum

What is a CSS Type Selector?

By

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.