CSS syntax rules consist of two main components: selectors, and one or more declarations.
The following shows you the CSS syntax structure:
For example:
h1{color:red;font-size:14px;}
Worth different writing and units
Many of these attribute values have different notation and units, such as:
1. Color: In addition to red English words, there are #ff0000 16 color values, and RGB (255,0,0)
or RGB (100%,0%,0%) these ways.
2. Font Size: units with Px,em and so on.
Here no longer one by one for example, I will fill in this part of the knowledge in the later finishing.
Remember to write quotes
Value is a number of words, you enclose the value in quotation marks. For example:
" Sans serif ";}
Multiple declarations
If more than one declaration is defined, separate each declaration with a semicolon. The last statement is also preferable to a semicolon, which avoids the error of adding or subtracting the declaration. In addition, only one attribute per line is written to enhance readability. For example:
p { text-align:center; Color:black; Font-family:arial;}
Spaces and case
In general, whether the inclusion of spaces does not affect the effect of CSS in the browser, the same CSS is not sensitive to case.
However, please do not leave a space between the attribute value and the unit, if you use "margin-left:20 px" instead of "margin-left:20px", it is only valid in IE 6, but in Mozilla/firefox
or Netscape, but not working properly.
Similarly, class and ID names are case sensitive when it comes to working with HTML documents.
Therefore, for insurance purposes, strictly case-sensitive, and there can be no space between the attribute value and the unit.
Two CSS Basic syntax