CSE691/891 - Internet Programming Summer 2001
prev next

Cascading Style Sheets (CSS)

This page starts a new topic: cascading style sheets. The purpose of stylesheets is to separate page content from presentation. Current design vogue is to attempt to restrict an HTML page to containing, and providing the structure for content. Cascading stylesheets provide relatively precise control over how that content is presented.

We will see that stylesheets allow us to set styles for any tag, set style classes that can be applied to any of the page's tags, and to provide styles that are inherited by all tags.

Styles can be added to your html pages in three ways:

  1. Embed style attributes in many of the tags in your html pages. This method is falling from favor because it is very hard to maintain. You may have to make many tag edits if you decide to change a style.
  2. Embed a style block in the <head> section of your html page:
    <style> ... </style>
    This is a much better solution, since it allows you to specify styles applied to every tag of a given type. But it would be better to find a way to uniformily apply styles to many of your pages from one source. That is the third method.
  3. Link to a separate stylesheet file:
    <link rel="stylesheet" type="text/css" href="lecture.css">
    The lecture.css sheet is used to style this page, for example.
You will find a lot of useful reference material by following the link given below.


Cascading Stylesheet References CSS Ref



prev next