Webpage design: Use the CSS abbreviation to accelerate your website

Source: Internet
Author: User
Tags file size
About CSS
Use CSS for website acceleration
The key indicator of Web site availability is speed. More specifically, the speed at which a page can appear in a visitor's browser window. There are many factors that affect the speed, including the speed of the Web server, the Internet connection of visitors, and the size of files that must be downloaded by the browser. Although you cannot control the server and connection speed, you can control the file size on the web page of the website.
To make websites faster, Web Builders compress and optimize each image file on the website as usual, this often compromises the image quality to reduce the file size by several percentage points. Since CSS style sheets are plain text files and are relatively small compared with images, Web Builders seldom consider taking measures to reduce the size of their CSS style sheet files. However, you can greatly reduce the size of a style sheet by using CSS abbreviations and other simple techniques. In an informal special test on my own style sheet, I reduced the file size by about 25-50%.
Use CSS for website acceleration
The key indicator of Web site availability is speed. More specifically, the speed at which a page can appear in a visitor's browser window. There are many factors that affect the speed, including the speed of the Web server, the Internet connection of visitors, and the size of files that must be downloaded by the browser. Although you cannot control the server and connection speed, you can control the file size on the web page of the website.
To make websites faster, Web Builders compress and optimize each image file on the website as usual, this often compromises the image quality to reduce the file size by several percentage points. Since CSS style sheets are plain text files and are relatively small compared with images, Web Builders seldom consider taking measures to reduce the size of their CSS style sheet files. However, you can greatly reduce the size of a style sheet by using CSS abbreviations and other simple techniques. In an informal special test on my own style sheet, I reduced the file size by about 25-50%.
Use the abbreviation of CSS
The shorthand property of CSS is a special property name used to replace multiple sets of related properties. For example, the padding property is the top gap (padding-top), the right gap (padding-right), the bottom gap (padding-bottom), and the left gap (padding-left).
Using the write-down property allows you to compress multiple property/attribute pair attributes into a row of code in the CSS style sheet. For example, think about the following code:
. Sample1 {
Margin-top: 15px;
Margin-right: 20px;
Margin-bottom: 12px;
Margin-left: 24px;
Padding-top: 5px;
1st 2 3 4 5 6 7 8 9 pages
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.