导航
×
   ❮   
HTML CSS JavaScript PHP Go Sass W3C Colors ECMS

HTML 参考手册

HTML 元素(功能排序) HTML 浏览器支持 HTML 属性 HTML 全局属性 HTML 事件 HTML 颜色 HTML 画布 HTML 音频/视频 HTML 字符集 HTML 文档类型 HTML URL 编码 HTML 语言代码 HTML 国家代码 HTTP 状态消息 HTTP 请求方法 PX-EM 转换 键盘快捷键

HTML 标签

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <map> 标签


实例

带有可点击区域的图像映射:

<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379">  
    <map name="workmap">
    <area shape="rect" coords="34,44,270,350" alt="计算机" href="computer.htm">
    <area shape="rect" coords="290,172,333,250" alt="电话" href="phone.htm">
    <area shape="circle" coords="337,300,44" alt="一杯咖啡" href="coffee.htm">
</map>
亲自试一试 »

下面有更多实例。


定义和用法

<map> 标签用于客户端图像映射。图像映射指带有可点击区域的一幅图像。

<img> 中的 usemap 属性可引用<map> 中的 id 或 name 属性(取决于浏览器),所以我们应同时向 <map> 添加 id 和 name 属性。

area 元素永远嵌套在 <map> 元素内部。<area> 元素可定义图像映射中的区域。


浏览器支持

元素          
<map> Yes Yes Yes Yes Yes

属性

属性 描述
name mapname 必需。为 image-map 规定的名称。

全局属性

<map> 标签支持 HTML 中的全局属性


事件属性

<map> 标签支持 HTML 中的事件属性


更多实例

实例

另一个带有可点击区域的图像映射:

<img src="planets.gif" width="145" height="126" alt="行星" usemap="#planetmap">
          
         <map name="planetmap">
                <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="太阳">
                <area shape="circle" coords="90,58,3" href="mercur.htm" alt="水星">
                <area shape="circle" coords="124,58,8" href="venus.htm" alt="金星">
         </map>
亲自试一试 »

相关页面

HTML DOM 参考手册: Map 对象


默认CSS设置

大多数浏览器将使用以下默认值显示 <map> 元素:

map {
      display: inline;
    } 

Copyright ©2020-2026 freew3c.com All Rights Reserved 提供的内容仅用于学习和测试,不保证内容的正确性。