What I'm trying to do, is to create several colored boxes which are aligned horizontally.
<div class="outer">
<div class="bg bg1">
</div>
<div class="bg bg2">
</div>
<div class="bg bg3">
</div>
<div class="bg bg4">
</div>
</div>
--> complete code on Codepen
several facts:
- outer's
position
:relative
- bg's
position
:absolute
left
of bg1 to bg4 are different
If I set the width of "outer" to 100vw, everything will be fine.
But if it's greater than 100vw, for example 101vw, there will be a little extra space I can scroll down(strangely, there is no vertical scrollbar).
And if it's 300vw, where I can see three boxes from left to right, the vertical scrollbar will appear.
So my question is:
How come the width will affect the vertical scrollbar?
And if can't avoid that, is there any other way of implementing my idea? (I guess creating several divs is not a good way)