XML technologies / CSS / CSS Cookbook / General information / Different selectors for assigning styles / Type selectors

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

The term type selectors refers to selectors that name a specific element or HTML tag to which styles should apply. The following rules define specific font styles for the h1 and p elements on a web page (see the following figure):

h1 {
 font-size: 120%;
}
p {
 color: blue;
}

HTML elements to which CSS rules apply

Figure: HTML elements to which the CSS rules apply.

Note:
Note that some elements inherit property values from their parent elements. Thus, not only the paragraph text turns blue, but also its contained em element.

  

 

 

 

back to top