Selection List: Maxsize

They have: 39 posts

Joined: Jun 2000

Is it possible to set max size on the width of a selection box? By default its conrolled by the length of its items.

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Might be possible in IE with style sheets, otherwise I think the only way is to keep the options short?

Something like:
<SELECT style="width:50">
etc..
</SELECT>

might do it in IE, not sure though.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

If the max size really is an issue and you are loading the options dynamically, I would truncate them before assigning them to the selection list. It may make for an occasional unreadable option, but it won't force the user to scroll right, either. Another alternative would be to add a column to your database -- if that is where the data comes from -- consisting of short text.

John, I'm pretty sure I tried "style= " at some point, and if it did work for IE, it probably failed with NN. Then again, I may have tried to force a wider box.

Vinny

------------------
my site:GrassBlade: cut&paste javascript
moderator at:The Javascript Place
Javascript City

Where the world once stood
the blades of grass cut me still

They have: 231 posts

Joined: Feb 2000

The only way you can control the width of a select box is by the largest option value. What I do is create a dummy entry with non-breaking spaces.

<option>SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.