html - 删除图像链接上的奇怪点击框

标签 html css twitter-bootstrap

我正在使用 bootstrap 制作一些包含图像的按钮。

但是当我点击它们时,会出现一条奇怪的水平线,以及 FF 上的虚线边界框。

我已经尝试过 outline: none;,但它并没有改变任何东西...... 我怎样才能重新安排 html(或编辑 css)来解决这个问题?我不想要那些盒子(尤其是中间的水平盒子)

谢谢

html

<div class="button frontbutton col-md-4">
     <a href="/tips">
         <img src="url.png" class="buttonPic">
         <span data-i18n="buttons.tips">Tips</span>
     </a>
</div>

CSS

.frontbutton {
  padding: 15px;
}

.button {
  display: inline-block;
  color: #444;
  border: 1px solid #CCC;
  background: rgba(210, 210, 210, 0.62);
  box-shadow: 0 0 5px -1px rgba(0,0,0,0.2);
  margin: 0px;
  cursor: pointer;
  vertical-align: middle;
  text-align: center;
}

a {
  color: #199ACE;
  outline: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

img.buttonPic {
  width: 95%;
}

谢谢problem with the button

https://jsfiddle.net/pLkyqz0x/

更新

在制作 fiddle 时,我注意到是什么导致了灰色条(a:active 上的框阴影) 但 FF 上的红框仍然存在......

最佳答案

这是 a:focus { } 风格。所以你可以通过设置 a:focus { outline: none; 来删除它} 但是,这不被认为是最佳实践,因为焦点样式是一种可访问性要求。相反,您应该重新定义适合您的焦点样式。 (进一步阅读为什么这是不好的做法:http://www.outlinenone.com/)

关于html - 删除图像链接上的奇怪点击框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33152738/

相关文章:

html - Twitter Bootstrap 中的 Div 崩溃

html - 导航到其他页面时搜索文本框跳转

jquery - 如果 localstorage key 存在,追加 <li>

javascript - 如何转换从数据库检索的 svg 源代码并将其呈现为 html 中的图像

javascript - 从文本编辑器加载 html 时出现黑屏

html - 在 IE 中为 png 图像添加阴影

html - 垂直对齐容器

javascript - 在 canvas html5 中绘制方向为直立且模式为 vertical-rl 的文本

javascript - 打开键盘android,隐藏内容phonegap

html - Bootstrap cssStyle 标签忽略了 Spring MVC 3.2.8