html - Increase DIV width by float elements -
i want make div
auto increase width
. have tried it's not working: problem?
http://jsfiddle.net/silverlight/b6k8x/1/
html:
<div class="metro"> <div class="rail"> <div class="track">a</div> <div class="track">b</div> <div class="track">c</div> </div> </div>
css:
.metro{ position :relative; background :rgba(255, 255, 255, .03); width :150px; height :128px; padding-bottom :28px; overflow :hidden; overflow-x :scroll; } .metro .rail{ white-space:nowrap; position :relative; width :auto; background :rgba(255, 255, 205, .03); height :128px; min-height :128px; overflow-y :hidden; } .metro .rail .track{ text-align:center; display :inline-block; float :left; margin-right :10px; width :64px; height :128px; background :rgba(255, 105, 255, .3); }
you shouldn't limit width of metro class: http://jsfiddle.net/b6k8x/2/
.metro{ position :relative; background :rgba(255, 255, 255, .03); height :128px; padding-bottom :28px; overflow :hidden; overflow-x :scroll; }
Comments
Post a Comment