As search engines pay more and more attention to user friendly experience, redundant page code that affects the loading speed of websites is also a problem that cannot be ignored by websites. How to slim down a bloated page is also one of the required courses for every webmaster. Next, I will share my six tips on how to streamline the Page code for site slimming.
Direction 1: clear more space codes on the page
As shown in, many web designers may use a lot of space code when designing pages due to different coding habits. Although the space code size is small, it is much smaller, and a large number of space code pages will make our code abnormal and bloated. If we are clear about these unnecessary space code, it will simplify the website page.
Ii. layout webpages using DIV + CSS
Although div + css is now quite mature, many web designers may still use the old-fashioned table layout considering its compatibility and simplicity, as shown in. Although table layout is very convenient, its disadvantage is also obvious, that is, it will greatly increase the size of the webpage, especially the nesting of multi-layer tables. This layout will not only increase the volume, but also affect the crawling of search engines and the indexing of sites if there are too many embedded sets.
Iii. Reduce page dependence on JS
Reduce the JS dependency of webpages. JS is very unfriendly to search engines. Although javascript can produce a lot of results, a large number of JS in the web page will affect the crawling of pages and increase the size of webpages. Especially when the key location of the page is like the navigation bar, use the DIV + CSS design method as much as possible.
Iv. Try not to use embedded CSS
Embedded CSS is divided into two types: common embedded css in the head area, and inline CSS in the line that appears in the label, regardless of the built-in CSS method, the page size will be increased. In this regard, we can try to use external CSS to reduce the size of the Site Page.
5. convert html control mode to CSS Control
Many Web designers are used to controlling content within tags. For example, the img label uses width and height to control the image size. Convert the code into externally-tuned CSS to make the webpage code easier.
6. Perform GZIP compression on webpages
You may be familiar with this. This feature requires support from your server. GZIP compression generally compresses webpages by 30%-80%, which is the most important optimization effect.
The above six points are new to the author in slimming the site page. You can practice it. The author's site page originally had over 80 K, after these six directions are simplified, the page code is only over 20 K. It can be said that the effect is remarkable and I hope it will help you. The article is organized by the system home http://www.haoxp123.com