[英]How to style focus outline for accessibility purposes
I'm trying to style the outline of the field when in focus because my current outline is very hard to see. 我试图在聚焦时对字段的轮廓进行样式设置,因为当前的轮廓很难看清。 I know that some html elements are focusable by default, so I'm not quite sure to what element to attach the outline style.
我知道默认情况下某些html元素是可聚焦的,因此我不太确定要附加轮廓样式的元素。
Do I need to target all the potentially focusable elements? 我是否需要针对所有可能集中的要素? Like
喜欢
a:focus, button:focus {outline: 1px solid white; }
(including all the other elements)? (包括所有其他元素)? This does not seem like the right method.
这似乎不是正确的方法。
I have tried searching for the answer and all I can find is that outline must not be none
but other than then, I haven't found anything else. 我试图寻找答案和所有我能找到的是外形一定不能
none
,但不是那么其他的,我还没有发现任何东西。
Just go 去吧
:focus { outline: 1px solid white; }
to target all focussable elements. 以所有可聚焦的元素为目标。 No need to specify those elements explicitly.
无需明确指定那些元素。
Btw, this is short for 顺便说一句,这是简写
*:focus {outline: 1px solid white; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.