I've read a lot of articles describing how to center a img bigger than the div container. But I also need to scroll that image horizontally (specially for mobile devices) and I cannot explain myself the behaviour I get and how to fix it.
I use flex (through bootstrap classes):
<section id="container">
<div class="for-mobile d-md-none d-flex overflow-auto justify-content-center">
<img src="image_bigger_than_div"/>
</div>
<section>
Additionnal css:
.for-mobile img { flex:none }
The image is well centered and I can scroll on the right side but I cannot scroll on the left side. If I change the flex direction to row reverse, the opposite behaviour occurs. Why? How to fix this please?
Thx
NB: If I don't "justify-content: center", the img is not centered and I can scroll the full image.