Home  >  Article  >  Web Front-end  >  Why put the css file in the head

Why put the css file in the head

php中世界最好的语言
php中世界最好的语言Original
2018-02-23 10:07:413432browse

We know that in HTML files, we usually put css at the head and JS at the end. Why is this? Today I will give you a good analysis of the reasons for doing this.

This will load the css style first. When rendering the dom, it already knows its own style, so the rendering is successful.

If the css is placed at the bottom, then the dom needs to be rendered first, and then After loading the css, the previous dom will be re-rendered, which requires two renderings

I believe you have mastered the method after reading these cases. For more exciting content, please pay attention to other related articles on the PHP Chinese website!

Related reading:

What are the parameters of IE web page pop-up window

How to set the border and transparency style of Div

How to save the format of HTML's TextArea

##What is the difference between html, xhtml and xml# How to use base64 encoding for

##html pictures instead of

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

Statement:
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
Previous article:CSS pseudo-class selectorNext article:CSS pseudo-class selector