Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I align controls vertically?

Status
Not open for further replies.

tomouse

Technical User
Aug 30, 2010
50
I feel bad to post what seems to be such a simple question, but I've been trying this for a while and searching and can't find the answer. I have 4 controls (2 textboxes and 2 dropdowns) which I want sit alongside each other on the page with their upper edges vertically aligned. The textboxes are multi-line (4 rows), the dropdowns are just one line high. I want them to look like this:
Code:
---------------      ------   ------    ---------------------
|             |      |    |   |    |   |                    |
|             |      ------   ------   |                    |
|             |                        |                    |
|             |                        |                    |
---------------                        ----------------------
The controls all sit nicely on the same line, but the dropdown boxes have their lower edge aligned with the lower edge of the multi-line textboxes.

I thought a simple div with the style=vertical-align:top would do this, but it is making no difference. Can someone help me? Seems like it must be a very common requirement.
 
Wrap each input in a div, and float the divs:

Code:
div{
float:left;
}

...

<div><textarea cols=10 rows=4></textarea></div>

<div> <select><option>One</option><option>One</option><option>One</option></select></div>


<div> <select><option>One</option><option>One</option><option>One</option></select></div>

<div> <textarea cols=10 rows=4></textarea></div>



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top