View Full Version : Center Alignment

09-22-2006, 11:03 PM
I am trying to center align an element, however it is a bit more complex than this and the best way to explain it is probably with a demonstration.

I have a form, and for each element there is a description and an <input>. An example being:

<label for="useage"><span class="inputDesc longDesc">How many days a week do you plan to ride your bike to work</span>
<select id="useage" class="inputSet" name="useage">

<option label="1" value="1">1</option>
<option label="2" value="2">2</option>
<option label="3" value="3">3</option>
<option label="4" value="4">4</option>
<option label="5" value="5">5</option>


With the accompanying CSS code being:

margin: 0 10px 12px 0;
display: block;
float: left;
text-align: right;

width: 255px;

float: left;

The result is that the text is nicely aligned and the <select> is flush. However on many browsers the description text for the <select> runs onto two or three lines. The <select> however remains on 'one' line. How can I centre vertical align the <select> element in relation to the description text?

Regards, Freddie.