You are here:About>Computing & Technology>Web Design / HTML> CSS> CSS Selectors> CSS Type Selectors - What is a CSS Type Selector
About.comWeb Design / HTML
Newsletters & RSSEmail to a friendSubmit to Digg

What is a CSS Type Selector?

From Jennifer Kyrnin,
Your Guide to Web Design / HTML.
FREE Newsletter. Sign Up Now!

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 ;
}
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.