Home > Web Front-end > CSS Tutorial > Why put css at the top

Why put css at the top

王林
Release: 2019-10-29 17:44:40
Original
3843 people have browsed it

Why put css at the top

Reason:

The CSS file is placed at the top. On the one hand, the order of placement determines the priority of downloading, and more importantly, the browser rendering mechanism.

In the most ideal situation, we hope that the browser will gradually render the downloaded CSS and gradually display the page to the user. However, in order to avoid re-rendering page elements when styles change, the browser blocks the gradual rendering of content. The browser waits for all styles to be loaded before rendering the page at once.

In this way, if the CSS file is placed at the bottom, the browser prevents the content from being rendered gradually. While the browser is waiting for the last CSS file to be downloaded, a "white screen" appears (white screen when a new connection is opened). , then text, pictures, and styles appear last). This is very serious, because when the network speed is very slow, the CSS download time is relatively long, which naturally brings a "white screen" to the user for a long time, and the user experience is very poor.

Recommended tutorial: css tutorial

The above is the detailed content of Why put css at the top. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template