2

I've recently run into this very interesting bug(?) where my css includes:

width: calc(25% - 1px);

And the computed css shows:

width: calc(24%);

This was the case in

Firefox(Version 44.0.2),

Chrome (Version 49.0.2623.112 m),

and IE11 (Version 11.0.9600.18205)

Does anybody have any idea why this might be happening?

EDIT: same thing happens with calc(25% - 1em) and calc(25% - 1rem)

EDIT 2: here's an example https://codepen.io/martindoychinov/pen/wGYxOO

EDIT 3: apparently it is because im using LESS

1 Answers1

4

You're using LESS as your CSS pre-processor in your example.

You need to escape the expression

width: calc(~'25% - 1px');
Community
  • 1
  • 1
I.G. Pascual
  • 5,818
  • 5
  • 42
  • 58