CSS Introduction

  • Before you continue you should have a basic understanding of the following:
  • HTML / XHTML
  • CSS stands for Cascading Style Sheets.
  • Styles define how to display HTML elements.
  • Styles were added to HTML 4.0 to solve a problem.
  • External Style Sheets can save a lot of work.
  • External Style Sheets are stored in CSS files.

Working of Styles

  • HTML was never intended to contain tags for formatting a document.
  • HTML was intended to define the content of a document, like:
  • <h1>This is a heading 1</h1>
    <p>This is a paragraph.</p>
  • When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers.
  • Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process.</font>.
  • Note : To solve this problem, the World Wide Web Consortium (W3C) created CSS. In HTML 4.0, all formatting could be removed from the HTML document, and stored in a separate CSS file.

CSS Saves a Lot of Work!

  • CSS defines HOW HTML elements are to be displayed.
  • Styles are normally saved in external .css files.
  • External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!

CSS Versions

  • Cascading Style Sheets, level 1 (CSS1) was came out of W3C as a recommendation in December 1996.
  • This version describes the CSS language as well as a simple visual formatting model for all the HTML tags.
  • CSS2 was became a W3C recommendation in May 1998 and builds on CSS1.
  • This version adds support for media-specific style sheets e.g. printers and aural devices, downloadable fonts, element positioning and tables.