CSS document optimization, css document

Source: Internet
Author: User

CSS document optimization, css document

First, understand the rendering logic of CSS. It is searched from the last bit of the tag, for example :. myclass li a. First, it will traverse all the <a> and then see which <a> has <li> and which <li> has. myclass.

Therefore: 1. Too many levels will increase the CSS rendering workload.

As follows:

 

In addition, what else can be optimized?

2. Each attribute of the style in the figure excludes a single row. The larger the number of rows, the larger the file size, and it is hard to find and enter the crazy scroll wheel mode.

3. Long and long chain positioning. myclass li a span allows unfamiliar colleagues to constantly switch html and css documents to find the affected elements, affecting work efficiency. We recommend that you use clss with clear meanings.

4. Some common attributes can be extracted. During normal team work, the front-end and design will communicate some common styles before the design stage to the development stage, such as fonts and headers. There are also some common features, such as positioning and clearing floating attributes.

The following are optimized documents:

 

Of course, the efficiency improvement will not be obvious when the project volume is small. However, more benefits are the efficiency of subsequent maintenance. After all,As a technology, the purpose of work is to improve the company's income., Open-source and throttling.

Thank you for your advice.

 

Related Article

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.