Thursday, February 3, 2011

CSS tutorial

Syntax

Two main parts:
- A selector
- Declarations

 selector   declarations   
h1 {color: blue; font-size:12px; }
p {color:red;text-align:center;}



Selectors

1. ID selector
The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1":

 #para1  
{
text-align:center;
color:red;
}


2. Class Selector

The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for any HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a "."

No comments: