My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Ignoring scrollbar width in CSS vw?

Grey Davis's photo
Grey Davis
·May 9, 2016

CSS vw is pretty useless.

The problem with vw is that, when you use vw for width, it gives you the width of the viewport which includes the scrollbar width as well. Whereas the scrollbars are not a part of the website width and are always variable across different devices.

So whenever you use say, 100vw, you would always get 100% of the browser width plus some extra width because of the scrollbars which makes vw pretty much unusable.

Is there any way you can ignore the scrollbar widths while using vw?