css lesson 4

css syntax

In general, the syntax of css is made of three different parts:

  • the selector
  • the property
  • the value

But what on Earth does that mean?? Well if you've gone through my html tutorials, you should know about html tags. CSS is all about the style and display of your web pages and we should know by now that the first html element that affects what our webpage looks like is the body element defined in html with the <body> and </body>, other elements within the body include things like list, font, table, paragragraph, etc....

CSS can be applied any of those html elements. The "Selector" is the html element or tag that you wish to define with your css. The property is the attribute of that element that you want to change and each property can be given a value, lets take a look:

body {background-color: blue}

In the above chunck of code we have "body" being the selector, "background-color" being the atritbute of the body that we want to change, and "blue" being the value we want the back ground colour to have.

Ok, but how do we use it?

There are three ways to impliment your css, we went over them a little in theory in our last lesson, External Style Sheets, Internal Style Sheets and Inline Style.


When you are ready, click here for the next lesson where we make an External Style Sheet and learn how to use it in multiple web pages.


Lesson added Tuesday 16th December 2008