3

I would like to know how I can add a unit to a certain number of a variable in SASS:

$number: 10;
padding: $number / 2 & px;

the & does not work. Any help?

supersize
  • 13,764
  • 18
  • 74
  • 133

1 Answers1

5

try this:

padding: $number / 2 + px;

Googled your question => result this site

Mark
  • 6,762
  • 1
  • 33
  • 50
  • 1
    from the same linked page: "While this method works, it is far from ideal because it results in implicitly casting the initial value as a string (…) To work around this issue, there are two ways of doing this properly: $value: 42; $length: $value + 0px; (…)" – Herr_Schwabullek Aug 23 '18 at 07:18