CSS Syntax
A CSS rule set consists of a selector and a declaration block:
h1 {color:red; font-size:12px;}
“h1” is the selector, it points to the HTML element you want to style.
Everything within the curly brackets is the declaration.
“color” and “font-size” are the properties.
“red” and “12px” are the values.
The decloration block contains one or more declorations that are separated by a semicolon. Each decloration contains a property and a value that are separated by a colon.
Example
A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets:
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 starts with /* and ends with */. Comments can also span multiple lines:
p{
color: red;
/* This is a single-line comment */
text-align: center;
}/* This is
a multi-line
comment */