html - 如何从 Firefox 中的 <area> 元素中删除虚线边框?

标签 html css firefox

在 Firefox(当前版本 14.0.1)中,我得到一些 <area> 周围的虚线轮廓我创建的标签 here (http://mediabrands.com.au/) .我不仅看到一条虚线,而且一旦它出现我就无法摆脱它(例如通过单击另一个区域)。

enter image description here

我已经在这里和谷歌上搜索了相当长的时间,但仍然没有设法摆脱它们。它们不会出现在任何其他浏览器中。

我尝试过的事情(以及以下所有组合)都没有成功:

  • 添加outline: none到 img、map 和 area 标签(以及它们的 :focus:active )对应物。
  • 已添加 border: none对每一个。
  • 已添加 hidefocus="hidefocus"对每一个。
  • 使用 ::-moz-focus-inner{ border: none; outline: none; } 添加了各种组合每个元素。
  • 已添加 .focus(function(){ $(this).blur(); }) (jQuery) 到每一个。

我相信我已经用尽了我能够遇到的所有信息 - 是否有任何其他方法可以摆脱这些线条?

这是供快速引用的 HTML,以及可能存在某些我无法摆脱它的原因:

<img src="anatomy/dial/components/foundation.png" id="dial-map" usemap="#dial" />
<map name="dial">
    <area title="Ansible" class="tab" id="click-ansible" shape="poly" coords="412,419,376,447,313,474,248,487,247,434,327,415,374,377" href="#">
    <area title="Cadreon" class="tab" id="click-cadreon" shape="poly" coords="487,245,478,313,455,366,416,417,378,380,429,299,434,246" href="#">
    <area title="Orion" class="tab" id="click-orion" shape="poly" coords="418,73,453,117,482,191,484,242,431,244,422,180,378,111" href="#">
    <area title="Ensemble" class="tab" id="click-ensemble" shape="poly" coords="247,1,311,10,368,35,415,70,378,108,312,66,244,53" href="#">
    <area title="Reprise" class="tab" id="click-reprise" shape="poly" coords="73,69,111,39,176,8,242,2,243,53,172,66,112,108" href="#">
    <area title="Magna Global" class="tab" id="click-magnaglobal" shape="poly" coords="245,487,186,481,114,450,71,417,110,377,175,423,246,432" href="#">
    <area title="Airborne" class="tab" id="click-airborne" shape="poly" coords="69,414,37,373,12,316,2,244,55,244,68,322,106,375" href="#">
    <area title="Marketing Sciences" class="tab" id="click-analytics" shape="poly" coords="2,242,11,171,33,120,71,74,109,109,70,168,54,241" href="#">
    <area title="MB3" class="tab" id="click-mb3" shape="poly" coords="257,430,178,422,120,384,82,340,140,305,163,337,206,360,262,364,317,342,348,305,404,340,384,367,324,413" href="#">
    <area title="UM" class="tab" id="click-um" shape="poly" coords="307,134,245,116,246,56,309,68,375,109,418,178,430,237,429,288,404,339,350,303,368,246,358,198,344,169" href="#">
    <area title="Initiative" class="tab" id="click-initiative" shape="poly" coords="80,339,63,289,58,235,72,171,109,112,176,67,243,56,242,119,192,128,152,159,126,206,122,261,137,306" href="#">
    <area title="View Website" id="website" shape="poly" coords="173,330,139,292,133,213,161,167,196,143,245,129,305,146,336,176,359,246,339,300,309,335,260,352,209,351" href="#">
</map>

最佳答案

问题出在 dial.js 第 151 行的模糊焦点函数。删除它可以解决问题。

$("img, area, map").focus(function(event) {
    $(this).blur();
});

为了防止聚焦在区域元素上,设置一个tabindex-1,即

<area tabindex="-1" title="Ansible" class="tab" id="click-ansible" shape="poly" coords="...

演示:http://jsfiddle.net/SO_AMK/K8Adx/

关于html - 如何从 Firefox 中的 <area> 元素中删除虚线边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12851084/

相关文章:

javascript - 如何按类别获取第一张图像的来源?

html - 如何使用 CSS 将 'div' 塑造成旗帜

css - 使用 iCheck : checkbox and label on different lines (want them inline)

javascript - 在 body 之前发送 head 以尽快加载 CSS 和 JS

javascript - JS : Cross Browser Compatibility - my JS works in chrome, 不在 FF 中

php - 如何让 Node.js 高效处理多个请求?

javascript - 对延迟图像应用淡入淡出效果

javascript - Magnific Popup 的自定义标题

html - 为什么这张表不使用指定的尺寸?

html - 如何控制 Firefox 中表格单元格的溢出?