此csslint错误的目的是什么,如何消除该错误? [英] What is the purpose of this csslint error and how can I get rid of it?

查看:182
本文介绍了此csslint错误的目的是什么,如何消除该错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了以下CSS代码,以摆脱单击链接HTML元素后出现的轮廓.
CSS代码:

I added the following CSS code to get rid of the outline that was appearing after click on a link HTML element.
CSS Code:

.window-leveling-btn:focus {
  outline: 0;
}

然后,我收到以下csslint错误消息. 我不明白为什么我不应该这样做或者我应该如何正确地做到这一点.
错误消息:WARNING: Outlines shouldn't be hidden unless other visual changes are made. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none)

Afterwards I get the following csslint error message. I don't understand why I shouldn't be doing this or how I should do it correctly.
Error Msg: WARNING: Outlines shouldn't be hidden unless other visual changes are made. Use of outline: none or outline: 0 should be limited to :focus rules. (outline-none)

推荐答案

根据无轮廓的CSSLint页面:

焦点轮廓对于可访问性很重要,因为它可以直观地指示焦点在页面上的位置.对于仅使用键盘的用户,如果没有焦点轮廓给出的视觉指示,就不可能在网页上跟踪焦点.

The focus outline is important for accessibility because it gives a visual indication as to where the focus is on the page. For keyboard-only users, tracking the focus on a web page is impossible without the visual indication given by the focus outline.

基本上,CSSLint团队认为您不应该这样做,因为这会使用户更难以浏览页面.

Basically, the CSSLint team believes you shouldn't be doing that because it makes it harder for users to navigate the page.

为减少错误,这取决于您在其中进行编码的应用程序(命令行或文本编辑器).根据此CSSLint GitHub问题,您可以在评论中关闭对规则的处理,应该可以涵盖大多数情况.

As for suppressing the error, it would depend on the application you're coding in (command line, or a text editor). According to this CSSLint GitHub issue you can turn off the linting for a rule in a comment, which should cover most cases.

这篇关于此csslint错误的目的是什么,如何消除该错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆