This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Limit width of Select Box? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Limit width of Select Box?" Watch "Limit width of Select Box?" New topic

Limit width of Select Box?

kat luna

Joined: Jul 20, 2001
Posts: 16
Hi all.
My developer has a dynamic list box on one of his forms. ie: The Administrative user can create options which display in a Select Box for the General User to choose from. Our intention was for the Admin User to create options of about 50 characters max, but our business requirements do not allow us to restrict the size of the Option Name the Admin User creates.
This leaves us open to the possibility of a SelectBox that is hundreds of characters wide, throwing all table formatting out the window and causing the screen to scroll horizontally.
We've been arguing about this endlessly for days now, and apparently CANNOT limit the character input for the Option Name. Is there any way to manipulate the display of the Select Box to prevent it from exceeding a certain number of characters wide but still show very long Option Names?
The developer insists we should be able to display the first word in the List and place the remainder of the Option Name in a Tool Tip, but that's way beyond my ken. His other suggestion is to wrap the individual Options. Again, I've never seen this done... and it's my job to try to HTML his ideas.
Does anyone know how to do either of these things or have any other more realistic suggestions for limiting the width of the Select Box when we can't limit the length of the Option Name?
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
you can specify the width of a box with style with the newer browsers that support CSS. The only problem is, you can not see the whole word. It cuts it off.
<select size="1" name="blah" style="width:60">
hope that helps you out
I agree. Here's the link:
subject: Limit width of Select Box?
Similar Threads
drop down list display issue
Options in drop-down menu
Creating user in Oracle through JDBC
SELECT boxes in Netscape
get parameters from a dynamic select