Collect url, href, src of front-end interview questions
This article will share with you the grammatical rules and basic concepts of url, href, and src for front-end interview questions that I collect and organize daily. It is very good and has reference value. Friends who need it can refer to it
1. The concept of URL
Uniform Resource Locator (or Uniform Resource Locator/location address, URL address, etc., English: Uniform Resource Locator, often abbreviated as URL), sometimes also commonly known as web address (web address). Just like a house number on the Internet, it is the address of a standard resource on the Internet.
2. URL format
2.1 Standard format
Protocol type:[// Server address[:port number]][/resource level UNIX file path]File name? Query
2.2 Full format
Protocol type:[//[Access resources Required credential information@]server address[:port number]][/resource level UNIX file path]file name?query
where [access credential information@;:port number;?query;#fragment ID] are all options Fill in the items.
3. URL syntax rules
For example, the URL http://segmentfault.com/html/index.asp must comply with the following Syntax rules:
scheme: //host.domain:port/path/filename
3.1 Description
(1) scheme - Define Internet services type. The most common type is http
(2) host - defines the domain host (the default host for http is www)
(3) domain - defines the Internet domain name, such as w3school.com.cn
(4):port - defines the port number on the host (the default port number for http is 80)
(5) path - defines the path on the server (if omitted, the document must be located in the root directory of the website).
(6)filename - defines the name of the document/resource
3.2 URL Schemes
The following are some of the most popular schemes:
Scheme | Access | for... |
---|---|---|
http | Hypertext Transfer Protocol | Ordinary web pages starting with http://. No encryption. |
https | Secure Hypertext Transfer Protocol | Secure web page. Encrypt all information exchanged. |
ftp | File Transfer Protocol | is used to download or upload files to a website. |
file | A file on your computer. |
4. Types of URL
4.1 Absolute URL
Absolute URL (absolute URL) displays the file Full path, meaning that the location of the absolute URL itself has nothing to do with the location of the actual file being referenced.
4.2 Relative URL
A relative URL uses the location of the folder containing the URL itself as a reference point to describe the location of the target folder.
In general, you should always use relative URLs for files on the same server, they are easier to type and more convenient when moving pages from the local system to the server, as long as each file is relative The position remains unchanged and the link is still valid.
The following are several special symbols used to establish paths and their meanings.
(1) .: Represents the current directory, relative path. For example: Text or
(2) ..: represents the upper directory, relative path. For example: text or
(3) ../../: represents the upper-level directory The upper directory, relative path. For example:
(4) /: represents the root directory, absolute path. For example: [text] (/abc) or
5. The concept of href
5.1 Specification Explanation
href (Hypertext Reference) specifies the location of a network resource, thereby defining a link between the current element or current document and the required anchor or resource defined by the current attribute. Link or relationship.
5.2 Popular understanding
The purpose of href is not to reference resources, but to establish a connection so that the current tag can be linked to the target address.
6. The concept of src
source (abbreviation) points to the location of an external resource. The pointed content will be applied to the current document. The location of the label.
7. The difference between href and src
7.1 Different resource types requested
(1 ) href points to the location of the network resource and establishes a connection with the current element (anchor) or current document (link).
(2) When requesting the src resource, the resource it points to will be downloaded and applied to the document, such as JavaScript scripts, img images;
7.2 The results are different
(1) href is used to establish a connection between the current document and the referenced resource;
(2) src is used to replace the current content;
7.3 Browse The browser parsing methods are different
(1) If added to the document, the browser will recognize the document as a CSS file, download the resource in parallel and will not stop processing the current document. This is why it is recommended to use the link method to load CSS instead of using the @import method.
(2) When the browser parses it, it will suspend the downloading and processing of other resources until the resource is loaded, compiled, and executed. The same is true for pictures and frames, which is similar to applying the pointed resource to Current content. This is why it is recommended to place js scripts at the bottom instead of the head.
8. The difference between link and @import
Both are ways of externally referencing CSS, but there are certain differences:
(1) link is an XHTML tag. In addition to loading CSS, it can also define other transactions such as RSS; while @import belongs to the CSS category and can only load CSS.
(2) When link refers to CSS, it is loaded at the same time when the page is loaded; @import requires the page to be fully loaded before loading.
(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.
(4) link supports using Javascript to control the DOM to change the style; while @import does not support it.
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How Ajax calls the restful interface to transmit Json format data (with code)
ajax under Boa server Communicating with cgi (graphic tutorial)
Ajax Struts2 implements verification code verification function (graphic tutorial)
The above is the detailed content of Collect url, href, src of front-end interview questions. 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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.

Java programming implements random selection of test questions in the online examination system, which requires specific code examples. In modern education, using the Internet to conduct online examinations has become one of the common examination methods. In order to ensure the fairness and validity of the exam, the exam system needs to be able to randomly select test questions. This article will introduce how to use Java programming to implement random extraction of test questions in the online examination system, and provide specific code examples. First, we need to prepare test question data. Suppose we already have a test question bank. The test question bank contains multiple test questions. Each test question has

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 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.

What is the difference between src and href? Find out quickly! In the process of web development, src and href are two commonly used attributes. Although they look similar, they actually have different uses and applicable scenarios. In this article, we’ll dive into the differences between src and href and explain them with concrete code examples. In HTML, src is an attribute used to specify an external resource to be embedded or referenced. It is usually used to reference image, audio, video or script files. Unlike this, href is a hyperlink

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(

What are src attributes and href attributes? What's the difference between them? In HTML, the src attribute and the href attribute are two commonly used attributes for referencing external resources. Although they are somewhat similar in functionality, there are some differences in usage and types of referenced resources. First, let's take a look at the src attribute. src is the abbreviation of source, which is mainly used to specify the address of embedding/referencing external resources. It can be applied to some tags such as <script>, <img>

Both the src and href attributes are used to specify the address of the resource, but the purposes and usage scenarios are different: 1. The src attribute is used to specify the address of the external resource, while the href attribute is used to specify the target address of the hyperlink; 2. The src attribute is introduced It is used when media elements are used, and the href attribute is usually used in the <a> tag; 3. The src attribute tells the browser to load the specified resource and embed it into the current page, and the href attribute defines the web page to be opened after the user clicks , document, or other resource URL.
