I am struggling with a list of objects and a slider functionality. Whenever the right arrow is clicked, the left parameter animates to -500px.
Snippet from HTML:
<div id="container">
<div id="list">
<div class="elem"></div>
<div class="elem"></div>
<div class="elem"></div>
<div class="elem"></div>
// more ...
</div>
</div>
CSS Styles:
#container {
width: 500px;
overflow: hidden;
}
#list {
position: relative;
left: 0px;
}
.item {
float: left;
}
I am looking for a solution to ensure that #list
fits its content properly without pushing overflowed children to the next line.
Setting display: inline-block
seems like an option, but it does not work well without having a parent element with fixed width. How can I achieve this as intended?