What are the ways to introduce external css
Editor to share with you what are the methods of introducing external css, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
There are two ways to introduce external css, namely: 1, through the "@ import" instruction, syntax "@ import url (css file path); >"; 2, through the link tag introduction, syntax "".
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
Two ways of introducing CSS
1. Introduce through @ import instruction
The @ import instruction, which is part of the CSS language, is added to a tag in HTML when used.
@ import url (css/styles.css)
2. Introduce through tags (most commonly used)
The difference between the two ways
Tags belong to html tags, and @ import is a way provided by css. Tags can not only introduce css, but also do other things, while @ import can only introduce css
The difference in loading order: when a page is viewed, the css introduced by link is loaded synchronously, while the css referenced by @ import is not loaded until all other elements have been downloaded
Differences in compatibility: @ import is proposed by CSS2.1, so it is only supported above IE5. Lower versions of browsers do not support it, but tags do not have this problem
When you use javascript to control DOM to change styles, you can only use tags, because @ import is not controlled by DOM.
The above is all the contents of this article entitled "what are the ways to introduce external css?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!