Type Selectors

A Type Selector is a selector which defines defines directly how HTML tags should look when applied. Type Selectors are used when you want to make every occurrence of an HTML tag look like either within a block or within the entire page or site.

A Type Selector is denoted without any symbols. For example, let us say that we want every single paragraph (p) to have the text color of a dark green and all level one headers (h1) to be underlined, you would add this to your CSS…

p {
    color: darkgreen;
}
h1 {
    text-decoration: underline;
}

Notice the left brace ({) and right brace (}). The properties for the selector you are defining are always enclosed inside braces ({ … }). It's not necessary to use multiple lines or extra spaces, but this is common practice to make your CSS code more readable.

Type Selectors

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License