2
You can use flex-direction: row-reverse;
to indicate that the order of the elements will start from brings forward, thus the scroll
goes to the end of container
. It’s enough you reorder the div to get to your liking.
See how it looks in the example:
.container {
width: 500px;
overflow-x: scroll;
background-color: #ddd;
display: flex;
flex-wrap: nowrap;
flex-direction: row-reverse;
}
.item {
min-width: 150px;
height: 50px;
background-color: #f00;
margin: 5px;
}
<div class="container">
<div class="item">6</div>
<div class="item">5</div>
<div class="item">4</div>
<div class="item">3</div>
<div class="item">2</div>
<div class="item">1</div>
</div>
I managed using the
direction:rtl
Thank you!– winiercape
@Legal is an option too. Just remember that RTL means "right to left" is an orientation for screen readers to text that should be read from right to left as the Japones etc... so RTL would not be good by the semantic side of the thing. Mainly having other alternatives with both CSS and JS. But it’s still a solution :D
– hugocsl