Mar
18

The CSS Syntax

posted on March 18th 2012 in CSS Planeteers & Design Biz & How I Did It & TOOTS with 0 Comments

Clear and simple identification of the many parts of a css declaration.

 

A CSS rule has two main parts: a selector, and one or more declarations:

The selector is normally the HTML element you want to style.

Each declaration consists of a property and a value.

The property is the style attribute you want to change. Each property has a value.


CSS Example

A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets:

p {color:red;text-align:center;}

To make the CSS more readable, you can put one declaration on each line, like this:

Example:

p
 {
 color:red;
 text-align:center;
 } 

Want more info? Watch the video below and get started! Enjoy!

Web/Graphic instructor & designer, illustrator & recovering fontaholic.

We would love to hear your comments