-1

I'm using sass. I created a function that calculates pixels into rem. But there is always a whitespace behind the numeric value and thus Chrome cannto read that property. How can I change the function?

SASS

@function rem($pixels) {
  @return ($pixels/16)rem;
}


.header{
width: rem(120);
}

wrong CSS

.header{
width: 7.5 rem;
}

corrrect CSS

   .header{
width: 7.5rem;
}
user2520410
  • 459
  • 1
  • 5
  • 12

1 Answers1

1

Try interpolation for this:

@function rem($pixels) {
  @return #{($pixels/16)}rem;
}
Slawa Eremin
  • 5,264
  • 18
  • 28