Inheritance of Styles

Below is a more detailed example of inherited styles. The text-decoration style property in the style sheet is used to add features called decorations to text. By default, a web browser underlines <a> (anchor) elements. In this example, the a.nodec class overrides this default with text-decoration: none because it is more specific than the default.

li em in the style sheet applies bold fonts to all italic elements of lists

h1, em in the style sheet applies underline to all h1 elements and all italic elements

ul in the style sheet assigns a left margin of 20 pixels to all unordered lists

ul ul in the style sheet assigns a font-size of .8em to all unordered sublists of unordered lists. The tag <em> should not be confused with the measure 'em'. This is a very old typesetters word for the size of an uppercase M in any given font. So .8em specifies a font-size of 80% of that.


Syllabus for CSC225:

Go to the Go to the course web site