指定图片某块区域加超链接

来源:互联网 发布:小幸运网络连接 编辑:程序博客网 时间:2024/05/16 18:19

指定图片某块区域加超链接

  • 使用map 标签可以给图片某块区域加超链接

使用方法:
1)为map 标签首先加上id 属性用来为map 标签定义一个唯一的名称
2)为了保证兼容性再加上name 属性,属性值与id 的值相同
3)为map 标签所作用的图片加上usemap 属性,属性值为#id 名称
4)在map 标签内嵌套area 标签来实现给指定区域加链接
-< area shape=”” coords=”” href =”” alt=”” />
- shape 属性:定义链接区域的形状,常用值rect、circle
- coords 属性:确定区域的精确位置。填写坐标即可
- **href 属性:填写链接地址即可
- alt 属性:给链接加一些说明信息

<map id="imgID" name="imgID">     <area shape="rect" coords="100, 30, 300, 300" href="http://www.baidu.com" alt="baidu">    </area></map><img src="./1.jpg" alt="pic" usemap="#imgID" />
0 0
原创粉丝点击