I am trying to create a div where instead of images moving to the next line, it just overflows beyond the width of the browser.
HTML markup:
<div class="carousel">
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
<img src="http://placehold.it/200x200"/>
</div>
CSS
.carousel {
overflow: scroll;
overflow-x: hidden;
}
.carousel img{
display: inline-block;
}
Is there a way to do this without setting the width in the div?
CodePen Demo
Adjit source
share