0

I just started SASS studying and i met a problem. When i set a variable and wanted to use it, i got an error.

$color: blue

h1 color: $color

Then i got this:

"Error: Invalid CSS after \"h1 \": expected selector or at-rule, was \"{\"\A         on line 10 of C:/Users/Worddoc/Desktop/htmlandcss/sass/screen.scss\A \A 5: \A 6: @import \"compass/reset\";\A 7: \A 8: $color: blue\A 9: \A 10: h1 {\A 11:     color: $color\A 12: }"; }

What's problem?

1 Answers1

1

Change

h1 color: $color

To

h1
  color: $color

You see, indentation is very important for SASS to work properly, otherwise use SCSS for a more pure CSS feel (syntax-wise)

The SCSS code would be:

$color: blue;
h1 { color: $color; }
Aziz
  • 7,685
  • 3
  • 31
  • 54
  • Can you list me those errors that would crash SASS compiler? – Ali Rasheed Jul 17 '18 at 11:24
  • @AliRasheed `Invalid CSS after "h": expected 1 selector or at-rule, was "h1 color: $color;" on line 1 at column 1` you can test it out at SassMeister with the SASS compiler – Aziz Jul 18 '18 at 08:34