【问题标题】:CSS background gradient validationCSS背景渐变验证
【发布时间】:2011-08-08 14:05:41
【问题描述】:

我的网站样式表中有许多 CSS 样式,它们使用以下或变体:

background: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.0, #585858),
    color-stop(1.0, #ACACAC)
);
background: -moz-linear-gradient(
    center bottom,
    #585858 0%,
    #ACACAC 100%
);

我的问题是,在使用 W3C Validator 验证 CSS 时,我收到以下错误:

值错误:背景 -webkit-gradient(linear,left bottom,left top,color-stop(0.0,#585858),color-stop(1.0,#acacac)) 不是背景值:-webkit-gradient (linear,left bottom,left top,color-stop(0.0,#585858),color-stop(1.0,#acacac)) -webkit-gradient(linear,left bottom,left top,color-stop(0.0,#585858 ),color-stop(1.0,#acacac))

据我所知,CSS 没问题...这是验证器的问题吗?我应该让与我合作的测试团队意识到这一点?

【问题讨论】:

    标签: css w3c-validation


    【解决方案1】:

    您正在使用 CSS 属性的供应商特定实验性实现。它们不是有效的 CSS。

    验证器的一个选项允许您将供应商扩展从报告中的错误降级为警告(因此,如果您选择在生产站点上使用它们,您可以找到与使用非-标准扩展)。

    【讨论】:

    • 啊,是的……忘记添加了。我已经关闭了供应商特定的警告,但它仍然会引发错误。
    • 既然有这么多的草案标准飞来飞去,验证对 CSS 来说毫无意义。它对于捕捉明显的错误(即缺少冒号)很有用,但对于其他任何事情,它都是无用的。
    • @Rich Bradshaw W3C CSS3 Validator 甚至不能很好地捕捉明显的错误,因为它充满了错误并在报告中输出大量垃圾。
    猜你喜欢
    • 2012-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多