Home >Web Front-end >CSS Tutorial >HTML uses img tag to create images
This time I will bring you the use of img tags to create images in HTML. What are the precautions for using img tags in HTML to create images? Here are practical cases, let’s take a look.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML:基础img标签 做一个图库</title> </head> <body> <h1>收藏的图片</h1> <img src="1.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="2.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="3.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="4.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="5.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="6.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="7.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="8.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="9.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="10.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="11.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="12.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="13.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="14.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="15.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > <img src="16.jpg" style="max-width:90%" style="max-width:90%" alt="HTML uses img tag to create images" > </body>
</html> // 源码讲解 src:图片的路径 width:设置图片的宽度 height:设置图片的高度 alt:图片无法显示则显示描述文字(图库例子中并没有用这个属性) 关于路径分为相对路径和绝对路径 但有盘符的就是绝对路径 比如:file:///C:/Users/windows/Desktop/html/index.html(我的文件放到了桌面html文件夹的地方)
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Inline style improvement in HTML "San Mao's Classic Quotes"
Frequently Asked Questions in HTML 2
#What are the common problems with CSS selectors
The above is the detailed content of HTML uses img tag to create images. For more information, please follow other related articles on the PHP Chinese website!