A simple solution is to remove float:left
and replace with display:inline-block
, since you really do want inline
elements (as kind of hinted at with your class="inline"
).
inline-block
elements will naturally align to the text baseline, which means that longer names that spill onto new lines will push the vertical position of all elements down, therefore the person with the longest name will determine the vertical positioning of the other elements.
See demo or example code below:
CSS
div.inline {
display:inline-block;
padding-left: 40px;
padding-bottom: 20px;
text-align: center;
font-family: sans-serif;
width: 90px;
}
HTML
<div class="inline">
short-ish username<br/>
<img src="http://lorempixel.com/80/100/cats/1"/><br/>
<select name="choice">
<option value="blank"></option>
<option value="cool">Cool</option>
<option value="uncool">Uncool</option>
</select>
</div>
<div class="inline">
name<br/>
<img src="http://lorempixel.com/80/100/cats/2"/><br/>
<select name="choice">
<option value="blank"></option>
<option value="cool">Cool</option>
<option value="uncool">Uncool</option>
</select>
</div>
<div class="inline">
A really, really long username<br/>
<img src="http://lorempixel.com/80/100/cats/3"/><br/>
<select name="choice">
<option value="blank"></option>
<option value="cool">Cool</option>
<option value="uncool">Uncool</option>
</select>
</div>
<div class="inline">
Short again<br/>
<img src="http://lorempixel.com/80/100/cats/4"/><br/>
<select name="choice">
<option value="blank"></option>
<option value="cool">Cool</option>
<option value="uncool">Uncool</option>
</select>
</div>
<div class="inline">
V.short<br/>
<img src="http://lorempixel.com/80/100/cats/5"/><br/>
<select name="choice">
<option value="blank"></option>
<option value="cool">Cool</option>
<option value="uncool">Uncool</option>
</select>
</div>