develwithoutacause, 6 months ago #TIL #CSS calc can't add or subtract with a unitless 0. You must include units. /* Doesn't work. */ height: calc(0 + 100px); /* Works. */ height: calc(0px + 100px); https://stackoverflow.com/a/55406181/3995712 I can kind of see the argument why here, but it's strange to me that multiplication works, just not addition or subtraction. Definitely a foot gun to watch out for. I wonder how many linters would suggest unitless 0 here?
#TIL #CSS calc can't add or subtract with a unitless 0. You must include units.
calc
/* Doesn't work. */ height: calc(0 + 100px); /* Works. */ height: calc(0px + 100px);
https://stackoverflow.com/a/55406181/3995712
I can kind of see the argument why here, but it's strange to me that multiplication works, just not addition or subtraction. Definitely a foot gun to watch out for. I wonder how many linters would suggest unitless 0 here?
0