Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the difference between link and @ import in CSS and HTML

Shulou Source: shulou.com Published: 2022-06-01 04:01:26 09月22日 Update

This article introduces the knowledge of "what is the difference between link and @ import in CSS and HTML". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Difference 1: ancestral differences: link belongs to the XHTML tag, while @ import is entirely a way provided by CSS. The link tag can do many other things besides loading CSS, such as defining RSS, defining rel connection properties, etc. @ import can only load CSS.

Difference 2: difference in loading order: when a page is loaded (that is, when browsed by the viewer), the CSS referenced by link will be loaded at the same time, while the CSS referenced by @ import will wait until the page has been downloaded before it is loaded. So sometimes there will be no style when browsing the page where @ import loads CSS.

Difference 3: difference in compatibility. @ import is proposed by CSS2.1, so the old browsers do not support it. @ import can only be recognized by those above IE5, while the link tag does not have this problem.

Difference 4: the difference when using dom to control styles: when you use javascript to control dom to change styles, you can only use the link tag, because @ import is not controlled by dom.

Html, the full name of html, is a markup language that contains a series of tags. Through these tags, you can unify the format of documents on the network and connect scattered Internet resources into a logical whole. Html text is a descriptive text composed of html commands, and html commands can explain text, graphics, animation, sounds, tables, links, etc. Mainly used with css+js to build elegant front-end web pages.

That's all for the content of "what's the difference between link and @ import in CSS and HTML". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Differences tags browsing time styles pages controls content commands text more tags knowledge language elegance learning next things full name compatibility Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Shulou Tech Info NVidia macOS