Home Lectures > CSS


Cascading Style Sheets

Mr. Chris Ong

What is CSS?

  • CSS: Cascading Style Sheets
    • A style sheet language used to describe the presentation semantics (look and formatting) of a document written in a markup language.
    • Enables the separation of document content from presentation, including elements such as the layout, colours and fonts.

How to use CSS


    CSS internal

    CSS code

    CSS external


    CSS Syntax

    CSS Divisions & Spans

    CSS Div Code


    CSS Classes & IDs

    CSS class

    CSS IDs

Common CSS rules

  • Fonts & Text
    • font-style, line-height, text-align, font-weight, letter-spacing, font-family, word-spacing, color, text-decoration

  • Page Layout
    • padding, position, overflow, visibility, margin, clear, z-index, display, height, width, float

  • Backgrounds
    • Background-repeat, background-color, background-position, background-attachment, background-image

  • Images
    • border-style, border-color, border-width,

CSS Pseudo Classes

  • Useful for links

  • Usually suffixed to selectors for anchor tags
    • a:visited, a:active, a:focused
      • a:visited{color:#000000;}
        • links that have been visited are now black in colour.

Will CSS work with tables?

  • Yes, you can use it style entire tables or parts of tables through either inline styling, external styling or even with external stylesheets.

  • Suggestions of how you can CSS in tables:
    • Styling individual rows, columns, cells
    • Using classes to give a common style to all cells that you want to give a similar appearance.

See Designing Websites with Tables

Back to top

Back to Lectures Index.