Web front-end optimization CSS for best practices

Source: Internet
Author: User
Tags html page

Web Front-End optimization best practices the forth part is oriented to CSS. A total of 6 rules of practice are currently in line. See also the Mozilla Developer Center article: writing efficient CSS

1. Place CSS on top of code page (put stylesheets in the top)

I think the official explanation is somewhat vague. This article is actually related to user access expectations. CSS to the top, the browser can be targeted to HTML page from top to bottom parsing and rendering. No one likes to wait, and browsers have taken that into account.

2. Avoid CSS expressions (avoid CSS Expressions)

The individual believes that things that can be done through CSS expressions can be done by other means and are less risky.

3. Peel JavaScript and CSS from the page (make JavaScript and CSS External)

After stripping, it can be targeted to a separate processing strategy, such as compression or caching strategy.

4. Compact JavaScript and CSS (minify JavaScript and CSS)

It might be better if you don't have JavaScript and CSS. But, it's impossible, so, try to be small. Shorthand for grammar.

5. Use <link> not @importchoose <link> over @import

In IE @import instructions are equivalent to writing link tags at the bottom of HTML. And this goes against the first article.

6. Avoid using filter (avoid Filters)

--eof--

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.