Home > Article > Web Front-end > Is img a double-tagged element in HTML?
img is not a double-tab element in html. The img tag is a single tag used to define images in HTML pages. The img tag has two required attributes, the src attribute and the alt attribute.
The operating environment of this article: windows10 system, html 5, thinkpad t480 computer.
In html, the tag is a single tag.
Tag introduction:
tag defines images in HTML pages.
tags have two required attributes: src and alt.
Commonly used attributes:
alt text Specifies the alternative text of the image.
height pixels Specifies the height of the image.
src URL Specifies the URL for displaying the image.
width pixels Specifies the width of the image.
Code example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <img src="smiley-2.gif" alt="Smiley face" width="42" style="max-width:90%"> </body> </html>
(Free video tutorial: html video tutorial)
Running result:
Related recommendations: html tutorial
The above is the detailed content of Is img a double-tagged element in HTML?. For more information, please follow other related articles on the PHP Chinese website!