2

I’m trying to use an image map in <a> tag. It has worked in chrome but not hasn’t worked in IE. Is it okay to use an image map in <a> tag?

Here is my code:

<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>
Lloyd Nicholson
  • 474
  • 3
  • 12
wonki hong
  • 37
  • 5

2 Answers2

0

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

No. See the specification:

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

And interactive content is defined as:

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)

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
-1

Add # before map name

<map name="#planner_banner_map">
  <area shape="rect" coords="243, 1, 272, 30" 
  onclick="$('.planner_banner').hide();return false;"/>
</map>
Jyme
  • 332
  • 2
  • 13