<map>定义一个客户端图像映射。图像映射(image-map)指带有可点击区域的一幅图像。
注释:area 元素永远嵌套在 map 元素内部。area 元素可定义图像映射中的区域。<img>中的 usemap 属性可引用 <map> 中的 id 或 name 属性(取决于浏览器),所以我们应同时向 <map> 添加 id 和 name 属性。
必需的属性
id=unique_name:为 map 标签定义唯一的名称。
可选的属性
name=mapname:为 image-map 规定的名称。
示例:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <p>点击太阳或其他行星,注意变化:</p> <img src="https://ss.0133.cn/upload/image/885/902/932/1553322045901285.gif" width="145" height="126" alt="Planets" usemap="#planetmap"> <map name="planetmap" id="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="https://public.xp.cn/down/course_demo/html/area_tabs/sun.htm"> <area shape="circle" coords="90,58,3" alt="Mercury" href="https://public.xp.cn/down/course_demo/html/area_tabs/mercur.htm"> <area shape="circle" coords="124,58,8" alt="Venus" href="https://public.xp.cn/down/course_demo/html/area_tabs/venus.htm"> </map> </body> </html>
效果图:
以上就是HTML中map是什么?的详细内容,更多请关注0133技术站其它相关文章!