Html 删除图像地图区域的轮廓

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4821724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 06:23:48  来源:igfitidea点击:

Removing outline on image map area

html

提问by Marc

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.

我在雪豹上使用 Chrome。

回答by Armel Larcier

It seems like all you got to do to remove these borders lies on the imgtag, by setting the hidefocusattribute and the outlinecss property on it like this:

通过像这样在其上img设置hidefocus属性和outlinecss 属性,您似乎只需在标签上删除这些边框即可:

HTML

HTML

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

CSS

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.

就像 Sergey K 评论的那样,如果您不打算支持 IE6,则可以仅使用属性选择器来节省字节。

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

Support starts with IE7.

从 IE7 开始支持。

回答by Amanda

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:

我在 chrome 和 safari 上都遇到了同样的问题,并通过为每个区域标签分配一个类 .map 并为该类提供以下样式而取得了成功:

.map {
outline: 0;
}

回答by Carsten Schmidt

Kinda old-fashioned, but does this work:

有点老式,但这样做有效:

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

?

?

GTX, CS

GTX、CS

回答by Eric

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

为您的图像地图指定一个“地图”ID,然后使用以下 CSS 声明:

#Map area {
    outline: none;
}

回答by kiwi

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!

因此,如果您有一个没有 css 的古老网页(我知道很糟糕!),您可以通过在坐标之后和区域标签内的 href 之前插入 style="outline:none" 来修复它 - 绝对完美!

回答by Endophage

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

使用 CSS。style="outline:none;"在元素上设置,或者最好将它放在样式表中。

回答by Gabriele Petrioli

Tried outline:0on its css rule ?

尝试outline:0过它的 css 规则?