Here is my HTML:
<div class="scrollingBox">
<div class="container">
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
<div class="item">Item</div>
</div>
</div
Here is my CSS:
.scrollingBox {
height:100px;
width:300px;
overflow:auto;
}
.item {
float:left;
height:60px;
margin:5px;
width:100px;
}
The .container
can contain any number of .item
s.
My problem at the moment is the .container
will never go wider than the .scrollingBox
, and the scrolling box ends up with a vertical scroll bar, and the .item
s end up stacking vertically. I give the .container
a fixed height, but the .item
s stack vertically beyond this fixed height.
I want the .container
to have no fixed width, so it can take any number of items. I want the scroll bar to be horizontal, and I also want the .item
s to stack horizontally.
My question:
What CSS do I apply to .container
to make the .item
s stack horizontally?