错误:" body":期望的选择器或at-rule之后的无效CSS是" {"在第4行

时间:2018-06-11 10:59:38

标签: html css sass bootstrap-4

我在style.scss中编写代码如下代码:body {margin-top:105px;}我从我的sass编译器(Koala)和style.scss

获得了此错误消息
  

错误:" body":期望的选择器或at-rule之后的CSS无效   " {"           在C:\ Users \ Petar \ Desktop \ Mizuxe novo \ scss \ style.scss

的第4行

我是初学者,所以如果您需要更多信息,请询问

https://codepen.io/petar-scepanovic/pen/Papmxj

/*
Error: Invalid CSS after "body ": expected selector or at-rule, was "{"
        on line 4 of C:\Users\Petar\Desktop\Mizuxe novo\scss\style.scss

1: $primary: #3292a6;
2: $primary-overlay:rgba(50,146,166, 0.8)
3: 
4: body {
5:   margin-top:105px;
6: }
7: 
8: 
9: .navbar {

Backtrace:
C:\Users\Petar\Desktop\Mizuxe novo\scss\style.scss:4
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/scss/parser.rb:1278:in `expected'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/scss/parser.rb:1208:in `expected'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/scss/parser.rb:42:in `parse'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/engine.rb:414:in `_to_tree'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/engine.rb:290:in `render'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/exec/sass_scss.rb:400:in `run'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/exec/sass_scss.rb:63:in `process_result'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/exec/base.rb:52:in `parse'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/lib/sass/exec/base.rb:19:in `parse!'
C:/Program Files (x86)/Koala/rubygems/gems/sass-3.5.2/bin/sass:13:in `<top (required)>'
C:/Program Files (x86)/Koala/bin/sass:22:in `load'
C:/Program Files (x86)/Koala/bin/sass:22:in `<main>'
*/
body:before {
  white-space: pre;
  font-family: monospace;
  content: "Error: Invalid CSS after \"body \": expected selector or at-rule, was \"{\"\A         on line 4 of C:\Users\Petar\Desktop\Mizuxe novo\scss\style.scss\A \A 1: $primary: #3292a6;\A 2: $primary-overlay:rgba(50,146,166, 0.8)\A 3: \A 4: body {\A 5:   margin-top:105px;\A 6: }\A 7: \A 8: \A 9: .navbar {"; }

1 个答案:

答案 0 :(得分:0)

你刚刚在CSS的第二行错过了一个分号。

更改 $ primary-overlay:rgba(50,146,166,0.8) 至 $ primary-overlay:rgba(50,146,166,0.8);

已经完成了。