W
W
Worddoc2016-02-21 11:27:19
css
Worddoc, 2016-02-21 11:27:19

Sass syntax issue. What is the problem?

Hello. Started learning the Sass preprocessor. Installed Sass(3.4.21v). When you try to set a variable, everything is a bunch. But when in practice I start to apply a variable as a style, an error appears (I tried to remove the brackets).

$color: blue

h1 {
  color: $color
}

The error is 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: }"; }

HELP!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Elena, 2016-02-21
@Worddoc

semicolon at the end of the line is required

V
VisualIdeas, 2016-02-21
@VisualIdeas

You have scss syntax!
www.internet-technologies.ru/articles/article_1950.html
and in general both should work with the sass module
but with your syntax the file extension should be .scss
and I would write like this:

$color: blue;

h1 {
  color: $color;
}

put yourself a linter (scss-lint) - it will describe the errors in detail and also highlight stylistic errors

D
Dmitry Voronkov, 2016-02-21
@DmitryVoronkov

Read about syntax. It seems like this:

$color: blue
h1
  color: $color

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question