CSS improved rendering Performance implementation method

Source: Internet
Author: User
Tags reset

The habit of writing CSS to determine the speed of page rendering, this point in the brain residual ie more obvious. Develop good habits, and even the formation of norms, will make your page faster loading, the user experience is higher, the following is a zero-free summary of some of the improved CSS rendering speed, for your reference.

1, do not use *{}

Often have front-end developers use *{margin:0 padding:0} for CSS reset, this method although write simple, but the rendering of browser engine to traverse all the tags, very effective, highly recommended not to use this!

Suggested Solution: Use these tags you use to deal with, for example: body,li,p,h1{margin:0 padding:0}, you can refer to the large web site CSS reset code.

2, the page with absolute positioning less

Absolute positioning (Position:absolute) is commonly used in web page layouts, especially when it comes to floating effects that make the page look cool. But because of the browser's rendering mechanism, if you use too much absolute positioning in your Web pages, your pages will become very slow.

Suggested solution: Use as little as possible, adapt to the same effect, and work with a workaround.

3, let the attribute as many as possible to inherit

As much as possible, some attribute children can inherit the parent element instead of overriding the parent element.

4, the level of CSS can not be too much

#zishu. Info. tool. Sidebar h2{font-size:12px;}, which is highly deprecated, recommended:. zishu-s-h2{font-size:12px;

5, do not vent the class

Do not empty class or no class in the HTML code, so meaningless.

6, a reasonable layout

Reasonable layout, you can change the style of CSS and rendering process, you can refer to the layout of large sites.

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.