DEV Community

Discussion on: Why 100vw causes horizontal scrollbar

Collapse
 
theonlybeardedbeast profile image
TheOnlyBeardedBeast

Most of the time I see juniors creating a section in a one-pager with 100vh and 100vw, 100vh from my part is understandable, if they don't want/or know how to setup html, body height. But if the element is already in a 100% container, and it doesn't need to overflow from a smaller container to achieve the 100% width, then why would anyone use 100vw? Especially if I need to style something I wouldn't make it render badly without js. Don't get me wrong I see that you recommend using 100%, just 100vw can make me really upset, thanks for the article :)

Collapse
 
tepythai profile image
Tepy Thai

Yeah, I would want to avoid the 100vw within a 100% container as well. Mostly I only use 100% for inner elements unless I really want the width to be relative to the viewport, then I would use 100vh. Anyway, thanks for the clarification :)