1. Reduce the number of HTTP requests. Merge images, CSS, and JS as much as possible. For example, if you load a page with five CSS files, it will make five HTTP requests, which will make users wait a long time when they first visit your page. If the five files are combined into one, only one HTTP request needs to be sent, saving the network request time and speeding up the page load. 2. Avoid empty SRC and href When the link tag has an empty href attribute and the script tag has an empty SRC attribute, the browser renders the current page URL as their attribute value and loads the page content as their value. So avoid this kind of oversight. 3. Put CSS at the top of the page when the resources are loaded from the Internet in order, so CSS at the top of the page can give priority to rendering the page, let the user feel the page load quickly. 4. Loading JS at the bottom will cause a block to subsequent resources, and you have to wait for the JS load to finish before loading the subsequent file, so you put JS at the bottom of the page to load last. 5. Avoid using CSS expressions As an example of a CSS expression HTML copy full-screen A.font-color: expression((new Date()).gethours ()%3? "# FFFFFF" : "# AAAAAA"); B. This expression will continuously evaluate the style on the page, affecting the performance of the page. In addition, CSS expressions are only supported by IE. 6. To cache CSS and JS files in external files, refer to Principle 4. But sometimes, in order to reduce requests, it will be written directly to the page, depending on the ratio of PV to IP. 7. Simplify CSS and JS This involves compression of CSS and JS. Now there are many compression tools, the basic mainstream front-end build tools can be compressed CSS and JS files, such as GLUP.Copy the code