The differences between URLs, SCR, and href in HTML

Source: Internet
Author: User

What are the URL, SCR, and href differences in HTML URLs?

URL: Uniform Resource Locators (Uniform Resource Locator), a Web browser requests a page from a Web server via a URL.

URLs are not attributes, src and href are attributes, SRC is used to replace the current element, href is used to establish a connection between the current document and the reference resource, i.e. the path referenced by SRC is the path to be loaded by IMG, and the path referenced by the href is where you want to jump.

What is SRC?

SRC is a shorthand for source, that is, to introduce the file, the purpose is to load the file into the HTML page, when the browser will pause the other content when parsing and will load the SRC content first, you must wait until the SRC content is loaded after the completion of the subsequent execution. This is why JS files are often placed at the bottom of the HTML file for the reason. If you put a JS file on the page head: Window.onload event processing. The browser recognizes the document as a CSS document, downloads the document in parallel, and does not stop processing the current document. This is also the reason to suggest using link instead of @import to load the CSS.

The content of SRC is an essential part of the page, and the content that is introduced to SRC is embedded in the document where the current label resides. Commonly used are: IMG, script, iframe. For example:

What is href?

The href is a shorthand for hypertext reference, which represents the link between a hypertext reference, the location of the network resource, the establishment and the current element (anchor point), or the current document (link), which is linked to the direct relationship to the page, The page itself does not stop loading other content when it is loaded. Used to establish a link between the current element and the document.

Commonly used are: link, a. For example:

<link href="reset.css" rel=”stylesheet“/>

The differences between URLs, SCR, and href in HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.