Entry
How do I set the width of a drop-down list (select tag) ?
How do I set the width of a drop-down list (select tag) ?
Jul 25th, 2002 22:29
Neeraj Singhal, Denny De La Haye, Ben Gordon, Rohit Kulkarni, jsWalter, Neeraj Singhal
In IE you can control the width of the box by adding style="width:
250px;" to the <select> tag just change the # of pixels to suit your
needs. However NS 4.xx allows very little use of CSS in forms so I
doubt that this will work for NS 4.
Hope This Helps Some
--
You'll find that most CSS that works in IE will work in Mozilla (and
browsers derived from it, such as NS6). In general, anything that
complies with the W3C standards should work...
---
I was facing similar problem while working on a site. The width of the
list box was so small (about 1/2 a inch) that the text strings included
in it were not visible completely. I didn't find a way to specify the
width of the list box, but I found a crude way to atleast show my
strings. In the <select> tag I added the first option as given below:
<OPTION VALUE="0">nnnnnnnnnnn</OPTION>
(where each 'n' represents the non breakable space given by 'ampersent
nbsp;'
doing this incresed the width of list box. Keep on repeating the 'n'
until you get the desired width of the list box (desired means until
the longest string in the list box is visible).
May be crude and static, but this was the only way I was able to
increase width of list box in Netscape4.76.
------ Neeraj