Forums > Education > (Cascading Style Sheets )CSS Syntax
  • Page 1 of 1
  • 1
naveedanjumjavaid


Age: 33 Male
4853 days old here
Total Posts: 353
Points : 12

Location:
quetta, Pakistan

Status : Offline
Subject : (Cascading Style Sheets )CSS Syntax
CSS Syntax
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;
}

CSS Comments
Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers.
A CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/
p
{
text-align:center;
/*This is another comment*/
color:black;
font-family:arial;
}

no likes.

Posted on September, 23 2011 02:42:29 PM


  • Page 1 of 1
  • 1