CSS 选择时从 HTML 文本输入中去除蓝色光晕

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9287803/
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-30 02:59:08  来源:igfitidea点击:

Removing the blue glow from an HTML text input when selected

cssinput

提问by JSW189

How can I remove the blue glow that surrounds a selected text input box using pure CSS?

如何使用纯 CSS 去除选定文本输入框周围的蓝色光晕?

回答by Purag

This should do it:

这应该这样做:

input:focus {
    outline:none;
}

EDIT (2015):If you are designing for a wide audience, recall that the outline is often a critical accessibility feature for users who navigate via keyboards or require more apparent visual feedback. If you remove the outline, make sure to define an alternative focus state that provides appropriate visual feedback to your users.

编辑(2015 年):如果您正在为广泛的受众设计,请回想一下,对于通过键盘导航或需要更明显的视觉反馈的用户来说,大纲通常是一个关键的辅助功能。如果您移除轮廓,请确保定义一个替代焦点状态,为您的用户提供适当的视觉反馈。

回答by wilsonpage

I prefer a nice solid reset like:

我更喜欢一个不错的固定重置,例如:

input, textarea, select, a { outline: none; }

Outline 'none' on anchor tags prevents horrible focus outlines on many Android browsers.

锚标签上的大纲“无”可防止在许多 Android 浏览器上出现可怕的焦点大纲。