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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fixed Size for Select Boxes

Status
Not open for further replies.

jsulman

Programmer
Jun 14, 2001
85
0
0
US
Greetings,
I was wondering if the was a way to fix the size of the html select objects.
I have two select boxes, from and to. A double click moves a selected item to the other select. However, the to box starts out with nothing and is very small. As I move elements into it, it grows according to the size of the largest element in the object. This makes my the table that the selects are in appear to jump around the screen.

Is there a way to fix their size with perhaps a horizontal scroll bar in each select?

Thank you in advance

Jeff Sulman
 
You could put the select boxes into a DIV or SPAN tag and set the overflow property for that tag to auto. Then if the field gets too wide you would get scrollbars instead of pushing out the table.
When dealing with the overflow property you have to leave enough room in your table cell for the size of the DIV plus the width of the scrollbar that may pop up and the scrollbar height/width varies from browser to browser so you would want to leave space to accomodate the largest.

To make your select box start out wider just put an empty selection as the first item or put in one that says "Please choose" or something similar.


Stamp out, eliminate and abolish redundancy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top