CSS writing is need to accumulate, and a good CSS writing habits for our future growth is very advantageous, I will usually see or meet the occasional update to here, from time to turn, but to improve.
If you crossing also have views and suggestions, comments, I will also update in, thank you!
1, CSS selectors are histograms from right to left, for example #nav Li, find all the Li first, and then to filter the parent element, to determine the matching parent element ... So the performance is actually very poor
So try to reduce the depth
2. Reduce the number of inline CSS
3. Use modern and legitimate CSS properties
4. Avoid using descendant selectors and use descendant selectors as much as possible
#tp p{} (Parent) #tp >p{} (Child)
5. Avoid using wildcard characters such as. MoD *{}
6, the name as far as possible not abbreviated, unless a look to understand the word
7, as far as possible unified in English, English shorthand or unified use Pinyin
8. CSS Comment <!----> single line comment/**/multiline comment
9. Some properties must conform to browser compatibility
10, all lowercase, and each CSS is defined as a line
11, all the decorative images to be written in the CSS
12. ID must be unique and defined in the document
13, CSS code naming is not recommended to use the middle bar connector
14, the proposed units use relative length units, such as EM and%
15. Use expression sparingly in CSS, and try not to use
16. Do not use filters in CSS, as filters can affect code read speed and compatibility
CSS Authoring Considerations (Occasional updates)