Currently, I am utilizing flexbox css to create a container with multiple div elements that should scroll horizontally. However, I am encountering an issue where adding more divs causes the container to shift to the left, resulting in some of the divs being hidden from view.
I'm puzzled by this behavior and would appreciate any insights. Here is the code snippet along with a link to the CodePen.
.scroll{
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
justify-content: space-evenly;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.item{
flex: 0 0 auto;
background: #e4e4e4;
width: 150px;
height: 150px;
margin: 10px;
}
<div class="scroll">
<div class="item">
</div>
<div class="item">
</div> <div class="item">
</div> <div class="item">
</div> <div class="item">
</div> <div class="item">
</div>
<div class="item">
</div> <div class="item">
</div>
<div class="item">
</div> <div class="item">
</div>
</div>
Thank you