1. Home
  2. Computing & Technology
  3. Web Design / HTML

What is a CSS Type Selector?

By , About.com Guide

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 ;
}
Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. CSS Selectors
  6. CSS Type Selectors - What is a CSS Type Selector>

©2009 About.com, a part of The New York Times Company.

All rights reserved.