关于SCSS,如何编译 *html{...} ?

请问,如何使用 scss 编译如下代码:

*html{
  background: url(about:blank);
  background-attachment: fixed;
}

编译报错提示如下内容:

自动编译(\sass\css\scss\base.scss)失败:
Error: Invalid CSS after "*": expected "{", was "html"
       
       "html" may only be used at the beginning of a compound selector.
        on line 16 of base.scss
  Use --trace for backtrace.

是什么原因呢?还望赐教,谢谢!

阅读 2.9k
2 个回答

“html”只能在复合选择器的开头使用 有*号了 就不要加html了

*html{background: url(about:blank); background-attachment: fixed;} 是个ie6的兼容写法,不过既然用了sass就不用估计低版本浏览器了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题