禁用焦点上的锚点()元素上的灰色边框
I am trying to make the ugly grey border that appears around anchor tags go away. The CSS property outline:none;
works for Firefox, but how can I do it in IE? Preferably using CSS expressions or jQuery. I'm not worried about accessibility BTW.
我试图使锚标签周围出现的丑陋灰色边框消失。 CSS属性outline:none;适用于Firefox,但我怎么能在IE中做到这一点?最好使用CSS表达式或jQuery。我并不担心BTW的可访问性。
Based on your suggestions I found these to be the best solutions:
根据您的建议,我发现这些是最佳解决方案:
The jQuery (for IE browsers):
jQuery(适用于IE浏览器):
$('a').focus(function() { $(this).blur(); });
Another jQuery option (for IE browsers only):
另一个jQuery选项(仅适用于IE浏览器):
$('a').focus(function() { $(this).attr("hideFocus", "hidefocus"); });
The CSS (for all other browsers that force an outline):
CSS(强制大纲的所有其他浏览器):
a { outline: none; }
Note: Some browsers such as Google Chrome don't force an outline on focus.
注意:某些浏览器(如Google Chrome浏览器)不会强制关注焦点。
7 个解决方案
#1
10
Unfortunately I think hideFocus
is your best answer as blur isn't always appropriate:
不幸的是,我认为hideFocus是你最好的答案,因为模糊并不总是合适的:
<a href="..." hidefocus="hidefocus">...</a>
http://msdn.microsoft.com/en-us/library/ms533783(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms533783(VS.85).aspx
更多相关文章
- [置顶] JQuery datatables 使用Fixedcolumns固定列控件
- 浏览器Bug在输入上显示时间文本
- 【jQuery】判断浏览器类型和版本
- jQuery Ui Draggable在移动端浏览器不起作用解决方案
- JS检查浏览器是否支持CSS Snap Points
- 目前最好用的“点击复制”功能,兼容主流浏览器
- ie8下jQuery动画没有ie7流畅,是浏览器性能问题吗?有没有什么解决方
- CSS样式如何解决IE浏览器不同版本的兼容问题
- 关于INPUT的autocomplete="off" 属性(浏览器表单默认的记忆功能)