Sass中的这个错误是什么意思? “非法嵌套:仅属性可以嵌套在属性下面”。 [英] What does this error in Sass mean? "Illegal nesting: Only properties may be nested beneath properties."

查看:2020
本文介绍了Sass中的这个错误是什么意思? “非法嵌套:仅属性可以嵌套在属性下面”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}

body {
font-family: 'Open Sans';
}

.navigation {
padding: 0;
margin: 0;
background: #333;
position: fixed;
top: 0;
z-index: 999;
width: 100%
li {
    display: inline;
    padding: 5px 10px;
    a {
        color: #e1e1e1;
        text-decoration: none;
        a:hover{color: lighten(#e1e1e1, 20%);}
        }
    }
}

但是每当我构建它并刷新网页,我得到这个错误:

But whenever I build it and refresh the webpage I get this error:

Syntax error: Illegal nesting: Only properties may be nested beneath properties.
        on line 23 of style.scss

这里是我的css代码, / p>

here is the my css code with line numbers

18:     z-index: 999;
19:     width: 100%
20:     li {
21:         display: inline;
22:         padding: 5px 10px;
23:         a {
24:             color: #e1e1e1;
25:             text-decoration: none;
26:             a:hover{color: lighten(#e1e1e1, 20%);}
27:         }
28:     }

我想这是创建问题的锚标签,但我不明白为什么。理论上它应该工作。

I guess it's the anchor tag that's creating the problem but I don't understand why. Theoretically it should work.

推荐答案

你缺少一个分号:

.navigation {
  padding: 0;
  margin: 0;
  background: #333;
  position: fixed;
  top: 0;
  z-index: 999;
  width: 100%;   <=== right here

这篇关于Sass中的这个错误是什么意思? “非法嵌套:仅属性可以嵌套在属性下面”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆