29

While ive been loving compass, I just ran to a confusing issue. I'm trying to subtract one from a value like this:

padding-left:($top-bar-padding*4)-1;
padding-left:($top-bar-padding*4-1);
padding-left:($top-bar-padding*4)-1px;
padding-left:($top-bar-padding*4-1px);

I've tried all of those and they all give me:

padding-left: 20px -1px;

It really puzzling me because I have this earlier in the .scss file and it is working fine:

padding:$top-bar-padding*2+2 $top-bar-padding*4;

Any insights on why this is happening?

Kos
  • 70,399
  • 25
  • 169
  • 233
locrizak
  • 12,192
  • 12
  • 60
  • 80

1 Answers1

53

You need to have a space before and after the subtraction symbol like this:

($top-bar-padding*4 - 1)
locrizak
  • 12,192
  • 12
  • 60
  • 80
  • 5
    at college we were taught hyphens aren't used in variable names for this reason, though this advice seems to have been ignored by css authors. The result ? This confusing problem, the old school guys are often right ! – Toni Leigh Sep 12 '13 at 07:46