Forum Moderators: open

Message Too Old, No Replies

Drop down menus

Setting the width of a select box

         

karen_pope

8:59 am on Feb 28, 2002 (gmt 0)



Was wondering if anyone knew if there was a way to set the width of a drop down menu rather than it being left to default resulting from the number of characters the options are.

I know that the size element allows you to set how may menu options are visable. Have tried width="" but doesnt work!

I could use non-breaking spaces but this is messy!

Any help will be much appreiciated!

joshie76

9:31 am on Feb 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS style attributes can control the width of SELECT boxes:

<select style="width:300px"> ...

However this will be ignored by Netscape 4.x - the only way I know to control the width of a SELECT box in NN4 is to modify the length of the options themselves.

tedster

9:48 am on Feb 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Width="" was a proprietary attribute that only works in Netscape 4, but it DOES work there. There's no harm in using a combined approach:

<select NAME="foo" WIDTH="150" STYLE="width: 150px">
<option>burger
<option>fries
<option>soda
</select>

joshie76

9:58 am on Feb 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice one tedster!

I didn't know that.

tedster

11:00 am on Feb 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



NN4 was my default browser for years, just so I would force myself to learn its many quirks! (I'm glad to be leaving it behind for Opera)