CSS (Cascading Style Sheet)


What Is CSS?
  • Styles define how to display HTML elements.
  • Styles were added to HTML 4.0 to solve a problem.
A CSS Example

     


Styles Solved a Big Problem.
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</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 became a long and expensive process. To solve this problem, the 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 pages in a web site, just by editing one single file!

Demonstration
The following demonstration shows how the script of HTML and CSS is displayed on the Web:

     



Review: CSS (Cascading Style Sheet)
    Which statement is NOT true about CSS (Cascading Style Sheet)?

      CSS can save you a lot of work.
      CSS defines how to display HTML elements.
      CSS were added to HTML 4.0 to solve a problem.
      HTML was intended to contain tags for formatting a document.
Result: