Little Web Hut
(Cascading Style Sheets) CSS 2.1 Reference

CSS Type Selector

 

What is a CSS Type Selector?

  • The type selector specifies the name of an element. This matches all occurrences of the named elements. More than one element can be specified by separating the element names with commas. In the following example, the text-align property will be set to left for all <h3> elements and will be set to center for all <p>, <h1>, and <h2> elements.
CSS Example:
  h3 {text-align: left;}
  p, h1, h2 {text-align: center;}
  <h1>The h1 text-align set to center.</h1>
  <h2>The h2 text-align set to center.</h2>
  <h3>The h3 text-align set to left.</h3>
  <p>The p text-align set to center.</p>
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style