输入字段 - 蓝色焦点突出显示?无法摆脱?
我已经尝试了一切方法来消除这个焦点蓝色突出显示,但似乎完全没有效果。
我已经尝试过:
input:focus {
outline: none;
}
我在这里读到的是正确的解决方案。但它不起作用。使用最新的 Chrome / Safari / Firefox,当单击焦点时,蓝色突出显示仍然存在。
它在 IE7 / IE8 中运行得非常有趣。我尝试了一个在堆栈上读取的 JavaScript 解决方案,其中我向输入添加了一个 onclick:blur 方法,但这只是使输入字段不可编辑?
大家有什么解决办法吗?如果可能的话,更喜欢干净的 CSS 解决方案。
I have tried EVERYTHING to get rid of this focus blue highlight and absolutely nothing seems to work.
I have tried:
input:focus {
outline: none;
}
which I've read on here is the correct solution. It's not working though. Using the latest Chrome / Safari / Firefox the blue highlight is still there when clicking into focus.
It works in IE7 / IE8 funnily enough. I tried a javascript solution I read on stack as well where I add an onclick:blur method to the input, but this just made the input field uneditable?
Any solutions guys? Would prefer a clean CSS solution if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只有在没有更具体的内容的情况下,那段 css 才会起作用。请记住,CSS 遵循最具体的规则,因此
您可以使用
!important
强制覆盖,尽管这可能会导致以后出现其他问题:使用 Firebug 查看元素的计算 CSS当它悬停时。它会告诉您应用于元素的规则来自哪里。
That bit of css would only work if there's nothing more specific. Remember, css goes by the most specific rule taking precedence, so saying
You can force the override with
!important
, though that can lead to other problems later on:Use Firebug to view the computed CSS for the element when it's hovered. It'll tell you where the rule(s) applied to element are coming from.
我遇到了同样的问题,这对我有用
I was having the same problem and this worked for me