No matter what kind of website, when users click on the website for the first time, they will load the Javascript and css code of the website. Assuming that these codes are redundant, it will inevitably slow down the opening speed of the website.
If there is such a problem, the code should be compressed or simplified. In terms of compression, there are a large number of third-party tools, such as CSSJS compression tool of Webmaster's House, which can be directly tried for free. The compressed code can generally be reduced by 40% to 65%. In simplification, one style can be used instead of two. The idea is to meet the page layout and minimum code amount of the website.
Two: reduce HTTP requests.
According to statistics, traffic devices will spend 80% of their time loading website elements such as scripts, css style sheets and pictures, and only about 20% of their time loading other main text contents of the website. The problem is that every website will have HTTP requests, and there can only be two HTTP requests at the same time. In this case, assuming that there are more than two HTTP requests at the same time, it will inevitably slow down the opening speed of the website. As shown in the figure:
To find out the impact of HTTP requests on the speed of web pages, the next solution is to reduce the number of HTTP requests.
3. Set the server-side cache for Javascript code, css code and pictures.
You find that if users visit your website for the first time, the next time they visit your website, the speed will be faster. What is the reason? The reason is the browser cache.
By default, most servers or spaces have the caching function set. What the webmaster or seoer needs to do is to set the corresponding file type and expiration time in the background. Here, the suggestions are: if it is a windows host, set the cache time of pictures, css and Javascript files to 30 days; If it is an ApacheWeb server, use the mod_cache module to turn on the caching function.
4. Optimize the reference pictures in css.
Suppose a page needs many surrounding pictures, such as the following icons. If these pictures are called separately, the number of requests will increase, that is to say, if there are too many cssimages, the number of requests will increase and the opening speed of the website will slow down.
If we combine the pictures needed by the page into one picture, the number of these picture requests will become 1, and the page speed will be relatively faster. How to put the needed picture on a picture and call it in the corresponding position? The method lies in coordinate positioning. That is, the image path is obtained through css coordinates, and the corresponding coordinates are referenced in the tag.
If you know the front end, then these are not big problems. If you don't know css, then the css picture merge generator class tool (Baidu can) can directly provide the corresponding content: merge CSS pictures and generate the corresponding code at the same time.
5: Skip position, skip loading order.
After the website is clicked, the page code is loaded from top to bottom. To this end, we can learn from it.
Relatively simple, we can check
For example, what is seo? Buttons such as sharing are placed at the bottom.
6: compress the image.
According to statistics, the picture loading time is the biggest factor that causes the speed of the website. When the problem of image loading speed is solved, the problem of page speed is solved by more than half. Suppose the website has a large number of pictures in jpg format, and it needs to be compressed as much as possible to reduce the size of the pictures themselves without affecting the vision. Similar to compressing Javascript files, there are a large number of online tools to provide corresponding compression services, and a large number of image editing software, such as Meitu Xiu Xiu, have compression functions.
7: The server side turns on the gzip compression function.
Gzip compression is an efficient data compression format. If gzip compression is turned on, the compression rate can generally reach about 75%, and the effect is very obvious.
Seo optimization of the above websites, just search 6 systems outside.
As the saying goes, plan before action, plan before communication. In order to guide our next work, we need to ma