CSS Authoring Considerations (Occasional updates)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.