Viewport units calculations not properly calculated

131 Views Asked by At

Why there is a difference between manually calculated height, and height calculated by the browser, using vh units. Because of this miscalculations i've got a problem at sub pixel level.

"1vh calculated by the browser: 5.34375px"
"1vh calculated using simple math: 5.3500000000000005"

And if 100vh is 535px then why there is this "...005" at the end when dividing by 100. There should be 5.35 and that's it, no weird digits after...

Test is in the fiddle.

https://jsfiddle.net/szpadel444/fdhvkygx/1/

0

There are 0 best solutions below