What is the difference between href and src, link and @import?
This time I will bring you the difference between href and src, link and @import, what are the precautions when using href and src, link and @import, the following is a practical case, let's take a look one time.
The difference between href and src:
##href (Hypertext Reference): Hypertext reference, commonly used tags are link, a, etc., are used to link referenced external resources. Define a link or relationship between the current element or current document and the required anchor or resource defined by the current attribute, such as:
TabSimilarly, the browser pauses loading until the image is fetched and loaded.
The difference between link and @import:
Both are ways of externally referencing CSS, but the differences are as follows :Difference 1: link is an XHTML tag. In addition to loading CSS, you can also define other transactions such as RSS; @import belongs to the CSS category and can only load CSS. .
Difference 2: When the link references CSS, it is loaded at the same time when the page is loaded; @import requires the page to be fully loaded before loading.
Difference 3: link is an XHTML tag and has no compatibility issues; @import was proposed in CSS2.1 and is not supported by lower version browsers.
Difference 4: link supports Use JavaScript to control the DOM to change the style; while @import does not support it.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:
How to use attribute value inheritance in css
Double Flying Wing Layout and Holy Grail Layout Detailed Graphical Explanation
The above is the detailed content of What is the difference between href and src, link and @import?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

src and href are respectively, 1. src is the abbreviation of source, which is used to specify the path of external resources. It is usually used to embed external files, such as pictures, audios, videos, etc. The src attribute is generally used on img, script, iframe and other tags. ; 2. href is the abbreviation of hypertext reference, which is used to specify the path of the target resource of the hyperlink. It is usually used to link to external documents or other pages. The href attribute is generally used on tags such as a and link.

1. @Import introduces ordinary classes @Import introduces ordinary classes can help us define ordinary classes as Beans. @Import can be added to the classes corresponding to @SpringBootApplication (startup class), @Configuration (configuration class), and @Component (component class). Note: @RestController, @Service, and @Repository all belong to @Component@SpringBootApplication@Import(ImportBean.class)//ImportBean through the @Import annotation

The src attribute and href attribute are commonly used attributes in HTML and are used to load external resources. Although they have similar purposes, there are some differences in usage and purpose. src attribute: The src attribute is used to specify external resources to be embedded in the document. It is mainly used to introduce external script files and media files into HTML documents. It can be used in the following situations: Introduce external JavaScript files: Link external JavaScript files to HTML pages through the src attribute.

In-depth analysis: What is the difference between link and import? When developing web pages or applications, we often need to introduce external CSS files or JavaScript libraries to enhance or customize our code. In this process, link and import are two commonly used methods. Although their purpose is to introduce external resources, there are some differences in specific usage. Syntax and location: link: Use the link tag to link external resources into the HTML file, usually located at the head of the HTML document

The difference between src and href, details you must know! When writing HTML pages, we often encounter the two attributes src and href. They are both used to reference external resources, such as script files, style files, or images. Although their purposes are similar, there are some differences in their specific usage and details. First of all, the src (source) attribute is mainly used to embed external resources, such as pictures or scripts. It is used to specify the address of a resource and embed its content into the current document. And href(

The differences between link tags and import include syntax and usage, functions and features, loading timing, compatibility and support, etc. Detailed introduction: 1. Syntax and usage. The link tag is an HTML tag, used to introduce external resources into HTML documents, such as CSS style sheets, JavaScript scripts, icons, etc. import is the module import syntax in ES6, used in JavaScript files. Introduce external modules; 2. Functions and features. The link tag can introduce a variety of resources, such as CSS style sheets, icons, etc.

Get requests sent by href and src. Detailed description: 1. The href attribute is used to specify the target resource of the link. When referencing an external style sheet, it will send a GET request to obtain the CSS file. When referencing the document, it will send a GET request to obtain the specified HTML file. When referencing an image, it will send a GET request. To obtain the specified image file; 2. The src attribute is used to specify the URL of the embedded resource. When referencing the image, it will send a GET request to obtain the specified image file. When referencing the audio, it will send a GET request to obtain the specified audio file, etc. .

The difference between import and link: 1. Purpose and semantics; 2. Loading method; 3. Compatibility; 4. Linking multiple style sheets; 5. Media type; 6. Dynamics; 7. Error handling; 8. Embedding set; 9. Default style; 10. Compatibility considerations; 11. Performance considerations; 12. Usage scenarios. Detailed introduction: 1. Purpose and semantics. Link is an HTML tag, used to link to external CSS files or style sheets. It is usually located in the head part of the HTML document, import is part of CSS, etc.
