CSS Syntax
Examples
CSS Examples
CSS rule consists of two main parts: a selector, and one or more declarations:
Selector usually you need to change the style of the HTML element.
Each declaration consists of a property and a value.
Properties (property) is the style attribute you want to set (style attribute). Each property has a value. Attributes and values are separated by a colon.
CSS Examples
CSS declaration always a semicolon (;) end, the group declared with braces ({}) enclose:
To make CSS more readable, you can describe one property per line:
Examples
{
color:red;
text-align:center;
}
CSS comments
Comments are used to explain your code, and can edit it, the browser will ignore it.
CSS comment with "/ *" starts with "* /" after the examples are as follows:
p
{
text-align:center;
/*这是另一个注释*/
color:black;
font-family:arial;
}