期待 RBRACE?CSS Lint 在谈论什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22747721/
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
Expecting RBRACE? What is CSS Lint talking about?
提问by Leo
CSS Lint thinks there is something wrong here. And so does the W3C CSS Validator. They are probably right and I am wrong, but can someone please help me understand why this is wrong?
CSS Lint 认为这里有问题。W3C CSS 验证器也是如此。他们可能是对的,我错了,但是有人可以帮助我理解为什么这是错误的吗?
CSS:
CSS:
.my-class {
width: calc(((100% - 15%) / 3 - 1px) * 3 + 10%); /* for 3 columns */
}
Error message:
错误信息:
Expected RBRACE at line 2, col 22.
By the way, browsers seem to be more on my side.
顺便说一下,浏览器似乎更站在我这边。
回答by Leo
It seems to be a problem with CSS Lint currently. Just a bit of bad parsing.
目前似乎是 CSS Lint 的问题。只是有点糟糕的解析。
CSS3 calc
is however still not a recommendation by W3C, but it looks very likely to be a standard soon. A warning would be the appropriate message from CSS Lint, of course.
calc
然而,CSS3仍然不是 W3C 的推荐标准,但它看起来很可能很快就会成为标准。当然,警告将是来自 CSS Lint 的适当消息。
回答by Sumner Evans
Per this articleit seems that calc()
isn't supported very well.
根据这篇文章,它似乎calc()
没有得到很好的支持。
2 years ago
The parser does not support calc()
2 年前
解析器不支持 calc()
It seems like it is sort of fixed, but not entirely.
它似乎是固定的,但并不完全。
回答by Itay Grudev
This is probably caused by the fact that arithmetics is an experimental featureof CSS and is certainly not in any of the CSS Specifications.
这可能是因为算术是CSS 的一个实验性特性,当然不在任何CSS 规范中。
Those services are created according to CSS specifications and no wonder they found an error in your code. The entire statement is invalid according to the specs.
这些服务是根据 CSS 规范创建的,难怪他们在您的代码中发现了错误。根据规范,整个语句是无效的。