MSc-IT Study Material
June 2010 Edition

Computer Science Department, University of Cape Town

Important Note About Rules

Notice in the given example how each rule is separated by a semi-colon (;). If your code is not working, ensure that the semi-colons are present.

There are three ways to apply the above CSS rules to an HTML file:

  1. add them in-line to the HTML file itself, attached directly to the relevant HTML tag.

  2. embed the rules into the HTML file

  3. link the CSS file to the HTML file

The next section will look at each of these methods.

Exercise 2

Add a style sheet property to the given example to change the text color to dark red. You can find the solution at the end of the chapter.