Optimization of CSS loading methods on the page

Source: Internet
Author: User

1. Place CSS on the top of the structure (usually in the head element ). CSS is an interpreted language. Firefox and IE will not render anything before the CSS transmission is complete. The page can be rendered only when the structure is parsed by the browser.

This causes the blank white screen problem. the page is totally blank until the stylesheet at the bottom is downloaded, on the order of 6-10 seconds for this page. the browser is waiting for the stylesheet to be loaded before it renders anything else in the page, even the static text.

The problem is that the page will be "simple" for a while, and suddenly "gorgeous", the user experience is very bad.

2. Try to use the <LINK rel = "stylesheet" href = "http://www.planabc/yuanxin.css" type =" text/CSS "> style import method to reduce @ import usage, do not use multi-layer nested @ import. In IE, @ import puts <link> at the end of the page.

This is a valid syntax, but, even though it's in the document's head, it breaks progressive rendering and instead causes the blank white screen and flash of unstyled content problems.

Additional reading:

  • Flash of unstyled content (fouc)
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.