First of all, separate your CSS from your HTML. You repeat too much code when you can just use the bar class for your inner divs.
bottom: 0
does not change anything for a relatively positioned div.
If you want to use relative positioning, get rid of float and bottom and use display: inline-block
and vertical-align: baseline;
. In addition, in this case, you need to get rid of any space in the HTML between the inner divs (newline).
Like this (you can see the demo at http://dabblet.com/gist/2779082 ):
HTML
<div class="graph"> <div style="height: 22px;" class="bar"></div><div style="height: 11px;" class="bar"></div><div style="height: 6px;" class="bar"></div><div style="height: 49px;" class="bar"></div><div style="height: 28px;" class="bar"></div> </div>
CSS
.graph { width: 50px; height: 50px; border: 1px solid #aeaeae; background-color: #eaeaea; } .bar { width: 8px; margin: 1px; display: inline-block; position: relative; background-color: #aeaeae; vertical-align: baseline; }
source share