SASS: Only properties may be nested in properties.

2019-01-28 08:50发布

问题:

I have the following SASS script, but PhpStorm says it's "Ilegal nesting: Only properties may be nested beneath properties." What's wrong with nesting element stylings? I come from LESS scripting, where this works just fine:

header

  nav
    float: left

      ul
        list-style: none
        margin: 0

        li
          float: left
          margin: 2px 5px

          a
            color: $blueish
            font-size: 0.8rem

How can I solve this?

回答1:

Sass syntax is extremely strict regarding indentation. You must be consistent.

$blueish: blue

header

  nav
    float: left

    ul // this was indented too far
      list-style: none
      margin: 0

      li
        float: left
        margin: 2px 5px

        a
          color: $blueish
          font-size: 0.8rem


标签: sass