注: 1.行元素,同行排列 2.常用图片格式:png、jpg、gif 3.网页通常加载图片比较费时,所有一般不要大面积使用大图片 4.可以与<a>标签、<map>标签组合使用 主要属性: src: 设置图片路径 alt: 设置无图片时,显示文字 width: 宽(通常在css中设置) height: 高(通常在css中设置)示例1:显示一张图片
<img src="tu.png" alt="无图显示文字" />![]()
示例2:图像链接
<a href="https://www.liboke.cn"> <img src="tu.png" /> </a>![]()
示例3:特定区域链接(坐标指定)
<img src="tu.png" usemap="#map1" /><!-- 注意:usemap的值开头是 # 字符 --> <map name="map1"> <area href="https://www.liboke.cn" target="_blank" shape="rect" coords="12,52,78,70" /> <!-- 可以多个area --> </map>area属性:(其它属性用法,查html标签属性) shape = "rect" 方形 coords = "x1,y1,x2,y2" 注:两组坐标都以图片左上角算距离
shape = "circ" 圆形 coords = "x,y,r" 注:xy指定圆中心,r为圆半径 shape = "poly" 多边形 coords = "x1,y1,x2,y2,x3,y3,......" 注:每组xy表示一个坐标,按顺序连起,首尾坐标自动相连