28

Is there anyway to remove the outline when you select an area on an image map? See: enter image description here

I'm using Chrome on Snow Leopard.

Rinat Khanov
  • 1,566
  • 10
  • 32
Marc
  • 2,584
  • 5
  • 33
  • 47

7 Answers7

63

It seems like all you got to do to remove these borders lies on the img tag, by setting the hidefocus attribute and the outline css property on it like this:

HTML

<img class="map" src="..." usemap="..." hidefocus="true" />

CSS

img.map, map area{
    outline: none;
}

This should work cross-browser!

EDIT

Like Sergey K commented, if you're not looking to support IE6 you can save bytes by just using an attribute selector.

img[usemap], map area{
    outline: none;
}

Support starts with IE7.

Armel Larcier
  • 15,747
  • 7
  • 68
  • 89
8

I was having this same issue with both chrome and safari and found success by assigning a class .map to each area tag and giving the class the following style:

.map {
outline: 0;
}
Amanda
  • 81
  • 1
  • 2
7

Kinda old-fashioned, but does this work:

    <area onfocus="blur();" ... 

?

GTX, CS

6

Give your imagemap an id of "Map" then use the following CSS declaration:

#Map area {
    outline: none;
}
Eric
  • 61
  • 1
  • 2
  • It doesn't work, cause the area tags inherits the outline from the image you've "added" the map tag to. So, to be sure, I've added the "outline: none;" property not only to the area tags, but to the main image too. – pesho hristov Aug 16 '13 at 11:43
2

So if you have an archaic webpage without css (I know awful!) you can fix it by inserting style="outline:none" after the coords and before the href within the area tag- absolute perfection!

kiwi
  • 21
  • 1
1

Use CSS. Set style="outline:none;" on the element, or preferably, put it in a style sheet.

Sebastian
  • 7,670
  • 5
  • 38
  • 50
Endophage
  • 21,038
  • 13
  • 59
  • 90
  • On what element? Putting on the area tag doesn't do it. Neither when putting it on the image tag. – patad Jun 16 '11 at 13:07
  • @meow I believe you want to put it on the `area` elements of the image map but if you're saying that doesn't work, then I'm really not sure. Double check there aren't any spelling/syntax mistakes... we all make them. – Endophage Jun 16 '11 at 14:33
0

Tried outline:0 on its css rule ?

Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317