W3C CSS 验证解析变量上的错误 [英] W3C CSS Validation parse error on variables

查看:34
本文介绍了W3C CSS 验证解析变量上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 Atom 上的 W3C CSS 验证包传递我的 .css 文件,它实际上向我为练习而创建的所有变量提供了解析错误"消息.下面是 :root 伪类的开头(但所有剩余的变量声明都同样有问题)

I am passing my .css file through the W3C CSS Validation package on Atom and it gives me a "Parse Error" message virtually to all variables created for the sake of an exercise. Here below there is the beginning of the :root pseudo-class (but all the remaining variable declarations are as just as faulty)

我已经尝试从头开始重写它们,替换它们或更改值只是为了检查行为,但没有任何改变.

I already tried to re-write them from scratch, replace them or change the values only to check the behaviour, but nothing changes it.

:root {
  --primary-color: #781820;
  --secondary-color: #ABABAB;
  --tertiary-color: #cead00;
  --backup-color: #FAFAFA;
...

除了修复错误之外,我还想了解错误所在,以便更好地理解流程.

Other than fixing the errors, I'd like to understand where they lie to better understand the process.

推荐答案

如前所述,这不是问题.CSS 变化太快,Jigsaw W3C CSS 验证器跟不上,除了最成熟的功能集(例如 CSS2 和最早的 CSS3 规范的功能集)之外,无法再依赖它进行检查.

As stated, this is a non-issue. CSS is moving and changing too fast for the Jigsaw W3C CSS validator to keep up, and it can no longer be relied on for checking anything other than the most mature feature sets such as those of CSS2, and of the earliest CSS3 specs.

遗憾的是,现在甚至无法可靠地使用它来检查粗心的错误(这是它一直以来的目的),因为真正的错误不断被这些虚假错误所掩盖.例如,它可能不会发现真正的拼写错误,因为它被它不支持的这些功能之一抛弃了几行.

It's a shame that it can't even be used reliably to check for careless errors now (which is what it's always been intended for) because the real errors are constantly getting occluded by so many of these fake ones. For example, it may not spot a real typo because it was thrown off a few lines up by one of these features it doesn't support.

如今最可靠的验证器是在浏览器中进行测试,并假设如果它在所有方面都一致运行,那么它就是有效的.或者,如有疑问,请在此处提出问题,并希望熟悉规格的人能够回答.如果有人问你是否尝试过验证 CSS,请告诉我.

The most reliable validator these days is to test in browsers and assume that if it works consistently across the board, then it's valid. Or, when in doubt, ask a question here and hope someone familiar with the specs will answer. If anyone asks you if you've tried validating your CSS, point them to me.

这篇关于W3C CSS 验证解析变量上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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