简体   繁体   中英

Error: Invalid CSS after “body ”: expected selector or at-rule, was “{” on line 4

I was writing code in style.scss the following code: body {margin-top:105px;} and i got this error message from my sass compiler(Koala) and in style.scss

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

I am beginner in all this so if you need more info just ask

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 {"; }

You just missed one semicolon on the 2nd line of CSS.

Change:

$primary-overlay:rgba(50,146,166, 0.8)

to:

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

and it's done!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM