What’s the math that would be done?
1280 is the viewport
Converting this:
2.5vw
What am I supposed to do?
What’s the math that would be done?
1280 is the viewport
Converting this:
2.5vw
What am I supposed to do?
Think of it as a percentage.
So it’s 2.5% of 1280
Or 2.5 / 100 x 1280
How can that be right when the red border here is 22px?
https://jsfiddle.net/ewn8srdv/2/
1280 viewport
I measured it at 31px, which is just one pixel out from the result I get from the calculation (32).
I get 32px now.
vw has to be tested outside of jsfiddle in full screen.
vw isn’t the same as percent. 100% would give you 100% of the available space and that would exclude any vertical scrollbars.
vw on the other hand is only interested in the viewport width and whether it has scrollbars or not is immaterial. Therefore 100vw would be larger than the available space should there be a vertical scrollbar.
It’s one of those things that doesn’t make a lot of sense and I believe the browser developers got it wrong.
Be careful about your frame of reference.
I go to your link.
My browser tells me the border is 28.938 pixels;
My browser width is 2560 pixels.
Work backwards.
28.938/X = 2.5/100;
28.938 = 2.5X/100;
28.938 = 0.025X;
X = 1157.52.
According to your fiddle, my browser’s only 1157.5 pixels big!
Oh… but wait.
jsfiddle loads the final result as an iframe… hmm… lets see…
…
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.