这次给大家带来html用img标签做图,html用img标签做图的注意事项有哪些,下面就是实战案例,一起来看一下。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>html:基础img标签 做一个图库</title>
</head>
<body>
<h1>收藏的图片</h1>
<img src="1.jpg" width="200" height="200">
<img src="2.jpg" width="200" height="200">
<img src="3.jpg" width="200" height="200">
<img src="4.jpg" width="200" height="200">
<img src="5.jpg" width="200" height="200">
<img src="6.jpg" width="200" height="200">
<img src="7.jpg" width="200" height="200">
<img src="8.jpg" width="200" height="200">
<img src="9.jpg" width="200" height="200">
<img src="10.jpg" width="200" height="200">
<img src="11.jpg" width="200" height="200">
<img src="12.jpg" width="200" height="200">
<img src="13.jpg" width="200" height="200">
<img src="14.jpg" width="200" height="200">
<img src="15.jpg" width="200" height="200">
<img src="16.jpg" width="200" height="200">
</body>
</html>
// 源码讲解
src:图片的路径
width:设置图片的宽度
height:设置图片的高度
alt:图片无法显示则显示描述文字(图库例子中并没有用这个属性)
关于路径分为相对路径和绝对路径
但有盘符的就是绝对路径 比如:file:///c:/users/windows/desktop/html/index.html(我的文件放到了桌面html文件夹的地方)
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
相关阅读:
html的内联样式改进《三毛经典语录》
html里的常见问题二
css的选择器有哪些常见问题
以上就是html用img标签做图的详细内容。
