Sass的新手,期望有选择器

我对sass陌生,并尝试了一些代码:

$blue: #3bbfce
$margin: 16px

.content-navigation
border-color: $blue
color: darken($blue, 9%)

.border
 padding: $margin / 2
 margin: $margin / 2
 border-color: $blue

但是现在在我的rails应用程序中,我收到此错误:

 Invalid CSS after "$margin": expected selector or at-rule, was ": 16px"

怎么了?


现在我尝试了zurb:

.your-class-name {
  @include button;
  @include dropdown-button($padding, $pip-color, $base-style);
}

但是现在我得到了错误

  Undefined mixin 'dropdown-button'.
Jim阿飞2020/04/03 10:47:31

在声明样式后,您会丢失分号。您还需要将选择器声明封装在大括号内:

$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color: darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}

您可能想阅读SASS创作者的入门文章