Ruby-on-rails sass 新手,期待预期的选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18517228/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
New to sass, expecting expected selector
提问by John Smith
Im new to sass and tried some code:
我刚接触 sass 并尝试了一些代码:
$blue: #3bbfce
$margin: 16px
.content-navigation
border-color: $blue
color: darken($blue, 9%)
.border
padding: $margin / 2
margin: $margin / 2
border-color: $blue
But now in my rails app i get this error:
但现在在我的 rails 应用程序中,我收到此错误:
Invalid CSS after "$margin": expected selector or at-rule, was ": 16px"
Whats wrong?
怎么了?
Now i tried something with zurb:
现在我用 zurb 尝试了一些东西:
.your-class-name {
@include button;
@include dropdown-button($padding, $pip-color, $base-style);
}
But now i get the error
但现在我得到了错误
Undefined mixin 'dropdown-button'.
回答by zeantsoi
You're missing semicolons after your style declarations. You also need to encapsulate selector declarations within curly brackets:
您在样式声明后缺少分号。您还需要将选择器声明封装在大括号中:
$blue: #3bbfce;
$margin: 16px;
.content-navigation {
border-color: $blue;
color: darken($blue, 9%);
}
.border {
padding: $margin / 2;
margin: $margin / 2;
border-color: $blue;
}
You might like to read over this primerfrom the creators of SASS.
您可能想通读SASS 创建者的这篇入门读物。

