I have a buch of multiple select boxes and I wanted to line them up in a line across the page. I thought I could do this with the help of divs, but for some reason I am running into trouble. Each select is being stretched across the entire width of the page even though I specified in the css that I didn’t want that. Why is this happening?
Also, I am giving each select a title by just putting text on top of it. Is there a better way to make a title?
HTML
<div class='bold'>
<div id="parameters">
<div class="section">Program<br> <select multiple="multiple" name="program">
<option value="SGS">SGS</option>
</select>
</div>
<div class="section">School <br><select multiple="multiple" name="school">
<option value="FLH">FLH</option>
<option value="MID">MID</option>
<option value="SUN">SUN</option>
<option value="MNC">MNC</option>
</select>
</div>
<div class="section">Term <br><select multiple="multiple" name="term">
<option value="Fall 2011">Fall 2011</option>
<option value="Late Fall 2011">Late Fall 2011</option>
</select>
</div>
<div class="section">Extension<br> <select multiple="multiple" name="ext">
<option>Something...</option>
</select>
</div>
</div>
</div>
CSS
#parameters{width:100%
height:150px;
border-style:solid;
border-width:2px;
border-color:grey;}
.section{width:50px;}
Divs are block elements so will stack on top of each other by default. If you want them to sit next to each other you will need to float them.
JSFiddle