DEV Community

Discussion on: Why 100vw causes horizontal scrollbar

joostkiens profile image
Joost Kiens

You are right, it has nothing to do with your explanation. However, it does have an impact on your debug code, specifically the border.

If the box-sizing is the default content-box, borders will be added to the total width of an element. So by using a border of 1px, you create a total width of 100% + 2px, which means you still get a horizontal scrollbar.

When using an outline this would not be an issue since an outline has no layout.