MSc-IT Study Material
June 2010 Edition

Computer Science Department, University of Cape Town

Chapter 10. Style Sheets

Table of Contents

Introduction to Style Sheets
Advantages of Style Sheets
Disadvantages of Style Sheets
CSS
Important Note About Rules
In-line Styles
Embedded Style sheets
Imported Style Sheet
Classes
Cascading Style Sheets
Review Questions
Review Question 1: Reflection on Style Sheets
Discussions and Answers
Discussion of Exercise 1
Answer to Exercise 2
Answer to Exercise 3
Solutions to Exercise 4
Solutions to Exercise 5
Solutions to Activity 1
Discussion of Review Question 1

Introduction to Style Sheets

There is no format to follow for teaching the aesthetics of style - most people, though, can recognise something that follows a classical design. But some things can be said about the style of a website. For instance, when Web pages belong to the same website, each page should have a consistent look in order to provide familiarity for the user.

Style sheets (sometimes referred to as templates) are used in desktop publishing to provide consistency when formatting text. The format applied by the stylesheet could be to indent every first line of a paragraph by 2cm, insert a page break at the end of every chapter, and so on. Naturally, due to multimedia, Web pages not only have to consider text formatting, but also visual and sound presentation, and various multimedia formats in general. Before we continue, let us briefly discuss the advantages and disadvantages of using style sheets.