I need to create a single line containing a variable amount of (floating?) divs: the container dimension is fixed, and it is supposed to add an horizontal scrollbar when nee
Edited: Combined DanielB's and my original answer. You need to put min-width
instead of width
for both sub
and ranking
and have the elements set to inline-block
with container having white-space: nowrap
. See: http://jsfiddle.net/5wRXw/3/
Edit 2: For your purposes, it might be better to eliminate the overflow
properties all together on the ranking
element. See http://jsfiddle.net/5wRXw/4/
#sub {
backgrond-color: yellow;
min-width:760px;
height:190px;
}
#ranking {
position:relative;
top:42px;
left:7px;
min-width:722px;
height:125px;
overflow-x:auto; /* you may be able to eliminate this see fiddle above */
overflow-y:hidden; /* and eliminate this */
white-space: nowrap; /* like DanielB */
}
#ranking > .player {
display: inline-block; /* like DanielB */
width:67px;
height:120px;
margin-left:5px;
background-color:#f3e1bb;
}