search

Image tag in HTML

Jun 04, 2018 pm 03:05 PM
htmlpictureLabel

This article mainly introduces the relevant information of HTML image img tag. Friends who need it can refer to it

Abstract

Start tag: required, end tag: none

##project instruction

Form

##Image  tag in HTML

Support

H2 / e2 / N2 / Fx1 / Op6 / Ch1 / Sa1

#Tag omitted

Description

img is the abbreviation of Image. The src attribute is used to specify the path to the image.

In HTML4.01, in order to cooperate with various browsers that cannot display images and audio reading browsers, the alt attribute in the Image  tag in HTML tag must be set. HTML5 becomes optional.

Although the height attribute and width attribute are not necessary, if these two attributes are set, the image can be opened faster, and certain display bugs can be avoided when displaying the image.

Attributes

[Important attributes]

【Features】

Attribute

Meaning

src=url

H2 /e2 /N2. The path to the image. Required attribute.

##alt=alt

H2 /e2 /N2 . Description of the picture. When some browsers cannot display the image, you can see the description of the image on the web page. It is a required attribute in HTML4.01.

##height=n

H3 /e2 /N2 . Set the image height.

##width=n

H3 /e2 /N2 . Set the image width.

e6 . When the mouse is placed on an image larger than 200×200, the toolbar is not displayed. It can also be specified globally in e4 /N2. If an image is large, it may take some time to display in the browser. While the image is still being transmitted over the network, you can use the lowsrc attribute to specify a thumbnail so that it is displayed on the browser first, and the thumbnail will be automatically replaced after the original image is transmitted. ##suppress

Attributes

Meaning

##align= align

H2-H4T/e2 /N2 . Specify the display position of the image. Set align="right" and align="left" to display text on the left or right side of the image. To cancel this effect, use
.

##border=n

H3-H4T/e2 /N2. Specifies the thickness of the border line around the image. When an image is included in a ~ tag, a border line will be automatically generated. If you want to cancel, set border=0.

##galleryimg

=bool

.

##hspace=n

H3-H4T/e2 /N2. Sets the horizontal margin around the image.

##longdesc=url

H4. Use this attribute to point to the URL of the document containing the image description when the image description is too long for the title attribute to be displayed in full.

##lowsrc

=url

=suppress

N4. suppress means to suppress. The default value is false. If set to true , the image During transmission, the small icon that should be displayed at the image location will be replaced by a ToolTip (prompt box).

vspace=n

H3-H4T/e2 /N2. Sets the vertical space around the image.

name=name

H4/e4 /N3. Specify name.

【Clickable field related attributes】

【Video related attributes】

Attributes

Meaning

##ismap

H2 /e2 /N2 . Specifies the image as a server-side image map.

##usemap=usemap

H3 /e2 /N2 . Specifies the image as a client image map. Please refer to .

Attributes

Meaning

##controls

e2-e3. Displays playback controls below the video. Deprecated in IE4.0.

##dynsrc=url

e2. Specify video file (*.avi). Because there are already

and tags, this attribute is basically useless.

loop=n

e2. Set play times. loop=

infinite will play in an infinite loop.

start=start

e2. When set to fileopen , the web page will be played as soon as it is opened. When set to mouseover , the video will start playing when the mouse is placed on it.

[Data binding related properties]

【General attributes】

Attribute

Meaning

datafld=datafld

e4. Specify the column name of the data source for data binding.

##datasrc=datasrc

e4. Specifies the ID of the data source when binding data.

H5. Draggable. ##dropzonehidden

Attributes

means

##class=class

H4 /e3 /N4 . Specify the class.

id=id

H4 /e3 /N4 . Specify ID.

style=style

H4 /e3 /N4 . Specify the style.

title=title

H4 /e4 /N6. Specify a title.

##dir=dir

H4 /e5 /N6 . Specifies the direction in which text is displayed.

lang=lang

H4 /e4 /N6 . Specify the language type.

accesskey=key

H5. Assign shortcut keys.

##tabindex=n

H5. Specify the order in which the TAB keys move in the control.

##contenteditable=bool

H5 /e55 . Make the element editable.

##contextmenu=id

H5. Specify contextmenu.

##draggable

=bool

=value

H5. Can be dragged and dropped.

H5+。隐藏元素。

spellcheck=bool

H5+。检查拼写。

IE扩展属性

可以指定IE扩展属性。

举例

HTML代码

举例图片

总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。

相关推荐:

PHP里面把16进制的图片数据显示在html的img标签上的方法

正则表达式怎么匹配图片地址与img标签

在ie中img标签内存泄漏怎么处理

The above is the detailed content of Image tag in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML vs. CSS and JavaScript: Comparing Web TechnologiesHTML vs. CSS and JavaScript: Comparing Web TechnologiesApr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version