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 is the difference between href and src, link and @ import in html

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "what is the difference between href and src, link and @ import in html" with detailed content, clear steps and proper handling of details. I hope that this article "what is the difference between href and src, link and @ import in html" can help you solve your doubts.

The difference between href and src:

Href (Hypertext Reference): hypertext references, commonly used tags such as link, a, etc., are used to link referenced external resources. Define a link or relationship between the current element or document and the required anchor or resource defined by the current attribute, such as:

Src (source): the introduction of resources, the introduction of src content is an essential part of the page. The introduced content is embedded in the current resource into the location defined by the current document element, such as img, script, iframe, and so on. Such as:

The loading and processing of the page is paused before the browser downloads, compiles, and executes the file (when the browser parses the element, the browser's rendering is paused), which is why it is recommended to load the js file at the bottom. The img tab is similar, and the browser pauses loading until the image is extracted and loaded.

The difference between link and @ import:

Both are ways of referencing CSS externally, but the differences are as follows:

Distinguishing that 1:link is a XHTML tag, you can define other transactions such as RSS in addition to loading CSS; @ import belongs to the category of CSS and can only load CSS.

The difference is that when 2:link references CSS, it loads at the same time as the page loads; @ import requires the page page to be loaded after it is fully loaded.

The difference between 3:link is the XHTML tag and there is no compatibility issue; @ import is proposed in CSS2.1 and is not supported by lower versions of browsers.

Distinguishing 4:link supports using JavaScript to control DOM to change styles; @ import does not.

After reading this, the article "what is the difference between href and src, link and @ import in html" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, 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

Internet Technology

Wechat

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

12
Report