


What are scr and href in html? What is the difference between scr and href? This article will introduce to you the difference between scr and href in HTML, so that everyone can understand what src and href are, so that everyone can distinguish scr and href well. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
When writing code, we often confuse the two attributes scr and href, and we can’t tell them apart; then let’s take a look at the two attributes scr and href, and then take a look at the HTML What is the difference between src and href?
What is src in html?
src is the abbreviation of source, which represents a reference to an external file and represents the location pointing to an external resource. The pointed content will be applied to the location of the current tag in the document (in simple terms: the purpose is To load the referenced file into the specified location of the html page).
The src attribute is an indispensable part of the page content. It is commonly used in js scripts, img pictures, frames and other elements. For example: What is href in
<script src="script.js"></script> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
<img src="/static/imghwm/default1.png" data-src="2.png" class="lazy" / alt="A brief discussion on what scr and href are in HTML? What is the difference between scr and href?" > <img src="/static/imghwm/default1.png" data-src="https://apps.bdimg.com/img/2.png" class="lazy" / alt="A brief discussion on what scr and href are in HTML? What is the difference between scr and href?" >
html?
href is the abbreviation of Hypertext Reference, which represents a hypertext reference. It represents the location of a network resource and establishes a link to the current element (anchor) or current document. It is linked to the page. A direct relationship is a linked relationship.
Commonly used ones are: link, a. For example: What is the difference between src and href in
<link href="reset.css" rel=”stylesheet“/> <a href="https://www.php.cn/"></a>
html?
1. Differences in request resource types
(1) When requesting the src resource, the resource pointed to will be downloaded and applied to the document, such as a js script, img picture, frame;
(2) href indicates the location of the network resource and is used to establish a connection with the current element or current document.
2. The difference between the results
(1) src attribute: used to replace the current content;
(2) href attribute: used between the current document and Establish connections between referenced resources;
3. Differences in browser parsing methods
(1) When the browser parses This sentence will pause 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 the current content. . This is why it is recommended to place js scripts at the bottom instead of the head.
Attachment: If you put js in the head, you must use src to introduce the external js file. Using the defer="defer" attribute will wait for the html document to be loaded before executing the js code, but the defer attribute can only Used in IE browser.
(2) If is added to the document, the browser will recognize the document as CSS file, the resources will be downloaded in parallel without stopping processing of the current document. This is why it is recommended to use the link method to load CSS instead of using the @import method.
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study. For more related tutorials, please visit HTML video tutorial, CSS basic video tutorial, bootstrap tutorial!
The above is the detailed content of A brief discussion on what scr and href are in HTML? What is the difference between scr and href?. For more information, please follow other related articles on the PHP Chinese website!

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

src和href分别是,1、src是source的缩写,用于指定外部资源的路径,通常用于嵌入外部文件,比如图片、音频、视频等,src属性一般用在img、script、iframe等标签上;2、href是hypertext reference的缩写,用于指定超链接的目标资源的路径,通常用于链接到外部文档或其他页面,href属性一般用在a、link等标签上。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

src属性和href属性是在HTML中常用的属性,用于加载外部资源。虽然它们有相似的目的,但在使用和用途上有一些不同。src属性:src属性用于指定要在文档中嵌入的外部资源,主要用于在HTML文档中引入外部脚本文件和媒体文件。它可以用于以下几种情况:引入外部JavaScript文件:通过src属性,将外部的JavaScript文件链接到HTML页面。

href和src发送的get请求。详细说明:1、href属性,用于指定链接的目标资源,引用外部样式表会发送GET请求来获取CSS文件,引用文档会发送GET请求来获取指定的HTML文件,引用图像时它会发送GET请求来获取指定的图像文件;2、src属性,用于指定嵌入资源的URL,引用图像时会发送GET请求来获取指定的图像文件,引用音频它会发送一个GET请求来获取指定的音频文件等等。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。


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

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.