Forum Moderators: open

Message Too Old, No Replies

drop down menus

         

em00guy

2:16 pm on Jan 15, 2002 (gmt 0)



Does anyone know how to constrain the width of a drop down menu. The size atribute only seems to effect the number of items displayed at once. Thanx

Marshall

2:19 pm on Jan 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are you referring to drops downs in Java, dhtml, or form fields? I know form fields are subject to browser display with NN4 being wider than IE or Opera, and NN6 being wider than NN4. The other two should have a width setting in pixels some where in the code.

bruhaha

7:20 pm on Jan 15, 2002 (gmt 0)

10+ Year Member



For the newer browsers, use an inline style:
style="width:40px;"

This will not work for NN4, so you need to add the width attribute:
width="40px"

Remember to use both, since new browsers will not display the width attribute.

mivox

7:20 pm on Jan 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In my experience, the length of the longest item on the list seems to determine the width of the menu. If you'd like the menu to be narrower, is there any way you can abbreviate the name of the longest item?

bruhaha

7:40 pm on Jan 15, 2002 (gmt 0)

10+ Year Member



In my experience, the length of the longest item on the list
seems to determine the width of the menu

This is the default behavior. But if you use the inline style I mentioned above, you can set the width to be wider or narrower than this if you wish.(I'm not sure why you'd want to hide some of the text and destroy the scrollbar, but you can if you really want to!)

It's a bit different for NN4 -- the box will alway be at least as wide as the widest item, but you can increase the width by adding the width attribute.