6

This is my sass:

table#orders {
    background-color:#ff0000;
}

However, when I actually run this, I got an error saying Invalid CSS after "#ff0000": expected expression (e.g. 1px, bold), was ";" I don't know why it is expecting something like 1px for background-color. Can anyone help me figure it out?

OneZero
  • 11,556
  • 15
  • 55
  • 92
  • The error message is showing *examples* of expressions. It's not specifically looking for `1px` or `bold`, but it's seeing stuff (specifically the semicolon) following the `#ff0000`, and that stuff doesn't match the syntax of an "expression". – cHao Nov 05 '13 at 15:41
  • An error like this would be thrown by the parser, which doesn't yet know about the specific properties you're trying to set. It just follows rules like "A *property-declaration* consists of a *property-name*, a *colon*, and one-or-more of *expression*". – cHao Nov 05 '13 at 15:48

2 Answers2

14

probably your sass file extension is *.sass, change to *.scss

*.sass has different syntax, that's why it throws these "crazy" errors.

*.scss support normal css synthax, like yours

if you got interested to learn about these syntax, we have a good question about this:

What's the difference between SCSS and Sass?

Community
  • 1
  • 1
Wagner Leonardi
  • 4,226
  • 2
  • 35
  • 41
  • 1
    This is happening to me with *.scss, years later. "Error: Invalid CSS after "...ckground-color:": expected expression (e.g. 1px, bold), was "#008eff12 !importan" on line 27 of scss/customdashboard.scss >> background-color: #008eff12 !important;" – Neithan Max Nov 03 '18 at 02:23
0

If you don't want to switch from sass to scss, you can change your code to this instead:

table#orders 
    background-color:#ff0000

this is the right formatting for SASS files. Here is a link: http://www.gotealeaf.com/blog/integrating-rails-and-bootstrap-part-1/

Kevin Zhao
  • 2,113
  • 2
  • 14
  • 18