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

Horizontal scrolling with a selection list?

Status
Not open for further replies.

awingnut

Programmer
Feb 24, 2003
759
US
I have a pop-up window that presents a selection list to the user. The problem is that fixed popup size will not play well with a selection list of variable width. If the list is longer then the height of the object, vertical scroll bars appear automagically. However, the width causes the browser to automatically expand the list horizontally so part of it is outside the window (including the vertical scroll bar).

Is there a way to fix the width of the selection box so that horizontal scroll bars appear? TIA.
 
I gather selection box is <select> element and it always expands to fit the selection eventhough you limit it smaller with css like so:
Code:
<select style="width: 200px;">
  ...
</select>
If that is the case, I suggest you implement JavaScript to resize the window accordingly after the content is loaded: JavaScript forum
 
Thanks for the reply. You gather correctly. The idea was to not resize the window at all as it could get quite large. The values in the selection list may be long but the user generally does not have to really see all of it to know what to select (the values come from a database and have other uses which is why they are long). It appears that solution is to use PHP to generate the list and truncate the values but its not very elegant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top