How to solve the impact of css js and images on website loading speed

Source: Internet
Author: User

The strict requirements for website loading speeds are the focus of seo optimization. How to increase website loading speeds, servers, and website content elements is closely related, this article describes css js and images in detail.

1. Images

(1) Specify the image size

Before loading the image, your browser starts rendering the page. The image size helps it surround irreplaceable elements. If no size is specified, your browser will return back once the image is downloaded. To do this, I suggest using the height and width label specifications in the element.

Do not use the image size scaling function, because the user still needs to download the size of the original file. In my opinion, the image does not need much screen space, as long as it can be clearly visible to the user.

(2) image Optimization

When using an image, it contains some additional things, such as useless colors and extra image sizes. Before using it, optimize it to keep the size to a minimum and try to save the JPEG format, which will help many slow network users. The reason for this is to keep the image quality under control and reduce the loading time of the server.

 2. Avoid CSS expressions

The HTML page progress indicator indicates that the process of loading a page from the browser is gradually from the page header, navigation bar, content, etc. If the CSS file is placed at the bottom of the page, many browsers will be still rendered, blocking rendering by these browsers will cause the page to be re-painted. CSS files must be placed at the top of the page, and CSS files should not use CSS expressions.

CSS expressions are a powerful and dangerous way to dynamically set CSS attributes. They support starting with Internet Explorer version 5, but are not used with IE8. As an example, you can set the background color to alternate using CSS expressions every hour:

GetHours background color: expression (new Date () 2% "B8D4FF #": "# F08A00"); CSS expression will increase the translation time of the page, extend the page loading time.

3. Use external js and css files

In the real world, external files are usually used to generate faster web pages, because the Javascript and CSS files in the browser are cached. The time required by Javascript and CSS to get the downloaded HTML file inline in the HTML document. This reduces the number of HTTP requests required, but increases the size of HTML documents. On the other hand, if the size of cached files, Javascript, CSS, and HTML files in an external browser does not increase, the number of HTTP requests is reduced.

Original article is by: http://www.leadseo.cn/seogongsi/dongtai/ webmaster first, reprint Please retain valid link address, thank you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.