Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to introduce external css

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report