parsing - CSS lint 解析错误 - 预期的 LBRACE 错误

标签 parsing keyframe csslint

需要一些帮助。

在 CSS lint 中查看我的 CSS 时,他们不断报告解析错误,即“预期的 LBRACE 错误” 这是问题的屏幕截图:screenshot

他们在我的右括号中显示了问题。我检查了我的代码好几次,但我就是找不到问题所在。

我意识到如果我更改关键帧前缀顺序,则错误会显示在不同的行上(因此并不总是在右括号上)

这是我的代码,请看一下,如果有人看到那里有错误,请告诉我错误是什么,提前谢谢:

.flat-desktop-content {
    background: url("../images/flat-desktop-content.svg") no-repeat scroll 0 0 transparent;
    background-size: cover;
    width: 360px;
    height: 290px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9;
    -webkit-animation: flat-desktop 6s ease infinite;
       -moz-animation: flat-desktop 6s ease infinite;
            animation: flat-desktop 6s ease infinite;
}

@-webkit-keyframes flat-desktop {
    0% { background-position: 0 0; }
    50% { background-position: 0 -234px;}
    0% { background-position: 0 0; }
}

@-moz-keyframes flat-desktop {
    0% { background-position: 0 0; }
    50% { background-position: 0 -234px;}
    0% { background-position: 0 0; }
}

@keyframes flat-desktop {
    0% { background-position: 0 0; }
    50% { background-position: 0 -234px; }
    0% { background-position: 0 0; }
}​

最佳答案

CSSLint 不是罪魁祸首。

问题是导致错误的代码中存在不可见字符。只需将光标放在有问题的行和列上,然后按退格键即可删除有问题的字符。

如果您将下面的代码复制到 csslint,您将不会收到错误,因为我删除了违规字符。

@keyframes monkey {
    0% { background-position: 0 0; }
    50% { background-position: 0 -100px; }
}

关于parsing - CSS lint 解析错误 - 预期的 LBRACE 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28347983/

相关文章:

css - 如何安装和使用我为 CLI 编写的自定义 CSLint 规则?

csslint 警告回退背景(十六进制或 RGB)应在 RGBA 背景 ."evidence="背景 : rgba(0, 0, 0, 0.8 之前);

matlab - 在 MATLAB 中解析文本文件

php - 在 Linux 上的 Zend 配置 ini 文件中包含花括号内的变量

ios - 解析 Xcode 8 和 swift 3 CompletianHandler 错误

css - 在@media 中嵌套@keyframe

IE 中的 css spinner 关键帧动画摇摆不定

c - 使用unput错误

flash - Haxe:没有帧的关键帧动画

node.js - 如何在不使用 grunt 或 gulp 的情况下在 Node JS 中检查 LESS 和 SCSS 文件?