javascript - 是否可以在 <a> 标签中使用图像映射?

标签 javascript html css

我正在尝试在 <a> 中使用图像映射标签。它在 chrome 中有效,但在 IE 中无效。 在<a>中使用图像映射是否可以?标签?

这是我的代码:

<div class="planner_banner">
        <a href="xxx">
            <img src="xxx" usemap="#planner_banner_map" border="0">
            <map name="planner_banner_map">
                <area shape="rect" coords="243, 1, 272, 30" 
                onclick="$('.planner_banner').hide();return false;"/>
            </map>
        </a>
    </div>

最佳答案

Is it okay to use an image map in <a> tag?

没有。参见 the specification :

The a element … Content model: Transparent, but there must be no interactive content or a element descendants.

interactive content定义为:

a (if the href attribute is present) audio (if the controls attribute is present) button details embed iframe img (if the usemap attribute is present) input (if the type attribute is not in the Hidden state) label select textarea video (if the controls attribute is present)

关于javascript - 是否可以在 <a> 标签中使用图像映射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53862233/

相关文章:

html - CSS 调整表没有效果

css - 内容元素覆盖的调整机制

javascript - jquery mobile 如何在 HTML 中注入(inject)类?

html - 当提交的表单字段为空时,mysql中的双数据类型存储null

javascript - 网页: Button to check self (HTML page) and open the next HTML page alphabetically located in the same folder

javascript - 无法通过在我的环境中使用变量来获取 DOMelement,但在控制台中我可以

javascript - Jquery-查找具有给定样式属性的元素

html - 使用 css 在 div 下对齐标记

javascript - 是否可以将 JS 应用程序 + NodeJS 解释器编译成单个可执行文件?

Javascript XML 数据到关联数组