HTML Section
1. Semantic HTML: Can make the code concise and clear, support different devices, easy to team development, search engines and users more friendly;
2. Reduce DOM nodes: Accelerate page rendering;
3. Add the correct width and height value to the Picture: reduce the page redraw, while preventing the image from zooming;
4. Avoid the src attribute and link 's href attribute to null: When the value is null, the browser is likely to load the current page as its property values;
5. Correct closing of the label ;
CSS Section
1. Avoid making CSS Expressions:expression (new Date ()). GetHours ()%2? " #B8D4FF " : " #F08A00 ″ ) ;
2. Avoid using CSSfilter(css filters);
3. Use CSS abbreviations to reduce the amount of code;
4. Using CSS Sprites to synthesize a picture of similar image, reduce the picture request;
5. Reduce the query hierarchy: such as . Header. Logo is better than . header. Top logo;
6. Reduce the scope of the query: like . Header>li to be better . Header Li;
7. Avoid coexistence of element tags with class or ID : a.top,button#submit ;
8. Delete the duplicate CSS, delete the blank, line break, comment.
9. use link instead of @import way to import the style;
JavaScript Section
1. Use as few global variables as possible;
2. Use the event broker to bind events, such as binding events on the body to proxy;
3. Avoid frequent manipulation of DOM nodes;
4. Do not use eval;
5. Reduce object lookups, such as a.b.c.d , which is very expensive to find, define it in variables as much as possible;
6. Delete the duplicate JS;
Server section
1. Try to merge CSS,JS files, or write them directly on the page to reduce the HTTP request;
2. Compress the content with gzip, compress the CSS,JS file can shorten the file transfer time;
3. Avoid 404 Error: Avoid Assigning a lockout page to 404, otherwise all 404 errors will be loaded once;
4. Strike a balance between reducing the number of DNS queries and concurrent downloads. General requirements to reduce the number of DNS queries, like a page of the request resources to use a different host name, which can reduce the number of concurrent download site, but many sites in order to speed up the download of resources in fact, the use of multiple host names .
5. Use CDN acceleration to allow users to download files from their nearest server;
6. Reduce the size of cookies,
7. Static resources Use None Cookies when clients request them, the domain can reduce Cookies The effect of repeated transmission on the primary domain name;
8. Specify Expiresfor the file header, so that the content is cached;
9. Put the CSS on the top, JS on the bottom, to prevent JS loading on the back of the resource block.
reduce favicon.ico and cache;
Website Performance Optimization Classification summary