Basics of CSS

by Kristina Alexandra


CSS, or Cascading Style Sheets, is a style sheet language developed to control the presentation of markup language documents, like HTML. You can think of HTML as controlling the structure of the web while CSS controls the presentation of it.


The best way that I can think of to display that visually is to think of HTML as the structure of a new building. You can see the structure as it's being built, but you don't really know what the building is going to look like. CSS, on the other hand, serves as the skin of the building, and determines what the outside of the building is going to look like. By separating structure and presentation in this way, you can change how things look by simply changing the CSS files, all without changing the underlying structure. In terms of syntax, CSS is not a markup language like HTML, or even a scripting language like JavaScript; it's style sheet language.

 
 

CSS styles are applied in the order that they're found and since styles can be placed in several different locations, this often results in a cascade of styles, from external documents all the way down to locally placed styles.

 

 

You can think of web sites as being controlled and constructed by five main elements:
- HTML controls the document structure;
- CSS controls the documents' look and field;
- JavaScript controls behaviour within the client, or browser if you prefer;
- server-side languages such as PHP control processing and business logic;
- and databases such as MySQL store content.

 
 

Before CSS

 
 

After CSS