Why viewport unit (vh vw) buggy? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why viewport unit (vh vw) buggy?

i read some respond from stackoverflow and he said it isn't recommended to use viewport unit because it's buggy. why is it buggy? I saw it's really responsive, when i'm playing with the width or height of Firefox browser also tried the mobile mode in Firefox, the elements of the page will adjust and it's looks fine and good. Is the bug fixed already? or is it buggy in other browser? or is it buggy in the other part? thank you master

23rd Jan 2021, 1:22 PM
Wan
Wan - avatar
4 Answers
+ 4
vw and vh units are very stable. I'm not sure what this person said. Can you paste a link to this stackoverflow discussion in case it reveals more context? The only mild annoyance I experience with those units is that 100vh creates a scrollbar. I'm not sure why 100vh would make a vertical scrollbar when I expect it to be exactly 100% the height of the viewport, though. I also set padding: 0; margin: 0; border-width: 0; to rule be sure no extra pixels are getting added by their defaults. I work around this by also setting overflow: hidden. This is weird but it is pretty minor and the workaround is simple.
24th Jan 2021, 5:59 AM
Josh Greig
Josh Greig - avatar
+ 2
That answer is from 2012 which is why he said the browser support was limited and buggy. I'm very confident that now in 2021 vh and vw are supported by enough browsers that you should use it without any browser support concern.
24th Jan 2021, 6:34 AM
Josh Greig
Josh Greig - avatar
+ 1
Josh Greig it's just an answer, not a discussion about the viewport it's the second answer of this discussion https://stackoverflow.com/questions/12904233/why-doesnt-em-font-size-resize-on-responsive-grid so, is it good if we use viewport unit? Thank you
24th Jan 2021, 6:22 AM
Wan
Wan - avatar
0
whoaa thank you master, no more doubt to use it 😄
24th Jan 2021, 6:35 AM
Wan
Wan - avatar