Current location - Health Preservation Learning Network - Slimming men and women - Who can tell me how to clean up css code quickly?
Who can tell me how to clean up css code quickly?
In code optimization (2), we introduced several factors that affect the speed of web pages and the reasons for slimming web pages. Today, in this section, we will introduce the methods and skills of slimming web pages in detail.

1. First, we need to delete the blank area.

Generally speaking, blank areas include spaces, line breaks, tabs, etc. , which has no influence on the webpage, can be safely deleted, and the deletion will not have any influence on the webpage. However, it is worth noting that in the process of modification, we should try to avoid modifying pre, textarea and tag that are affected by spaces in css properties. So in view of this situation, I suggest that you make a backup before doing seo website optimization.

2. Delete comments.

Marking is to make the code reader clear, and it has no effect on the beauty and speed of the web page. Therefore, except for the comments declared as ie and octype on the client, almost all comments can be removed, and all comments can be safely removed.

3. Use short format color representation.

When we use colors, we often like to use 16 hexadecimal and full-color names, which is more accurate, but we should try to use short format colors according to the actual situation, such as #000000, which is actually black.

4. Use short format characters.

Like the shortest color representation, some names can be represented by the shortest characters, and we can replace some long letters with shorter numbers. Step 5 get rid of useless labels

Some useless tags, such as repeated tags used many times, or meta tags used as advertisements in some editors, can be safely and boldly removed.

In the process of seo website optimization, the most basic part of code optimization is the five points mentioned above, and it is also the most basic work that must be done to speed up web page download. After removing these redundant codes, the remaining work is to optimize css and js. In the next section, I will introduce the optimization skills of css and js in detail.