css - 使用 sass 算术运算符时出现 W3c 验证错误

标签 css sass w3c-validation

我正在尝试使用 w3c 验证程序验证我的网站,我有以下 sass 代码。

$paddingXL: 140px;
.wrapper {
    width: 100%;
    max-width: 1360px + #{$paddingXL * 2} + 40px;
    margin-left: auto;
    margin-right: auto;
} 

编译成如下css代码

.Wrapper {
    width: 100%;
    max-width: 1360px + 280px + 40px;
    margin-left: auto;
    margin-right: auto
}

上面的代码在 w3c 上抛出以下验证错误

Error: CSS: Parse Error.

 + 280px + 40px;margin-left:au

验证器突出显示“;”在“40px”之后,有人可以帮我通过 w3c 验证吗

最佳答案

max-width: 1360px + 280px + 40px; 是无效的 css。您可以在 sass 中计算宽度:max-width: 1360px + $paddingXL * 2 + 40px;。只需删除 #{}

关于css - 使用 sass 算术运算符时出现 W3c 验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56146396/

相关文章:

html - Doctype over Meta X-UA-Compatibility

css - 我的动画课应该属于哪个类别?

html - 正文没有延伸到页面的最后?

html - 如何忽略 sass 部分文件中的注释?

html - 使用 "A numeric character reference expanded to carriage return."时出现 Nu Html Checker 错误 "
"

php - 我似乎无法在 header.php 上动摇验证错误(如 "Stray start tag html")

javascript - 非常基本的语法荧光笔

html - 在 CSS 中设置元素的高度和宽度的简写

html - 标记( block )引用作者的正确方法是什么?

javascript - Window.open 在 chrome 上