SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DropDown <select> width?

    is there a way to set the width of a <SELECT> dropdown list?
    I know by default it takes the width of the longest <option> but that wont work for me. can I override that?

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Code:
    select {
        width: 999px;
    }
    ??

  3. #3
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the browser that this is for doesn't take CSS, what else you got?

  4. #4
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only possibility I found was, in the <select> tag add 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, the width of list box can be increased. 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).

    Maybe this is crude and static, but this is the only way I know, able to increase the width of list box in browsers which do not support CSS.

    This is tested in Netscape 4.76.

  5. #5
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, Im looking to decrease the width-- screens are only so big on handhelds.

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Golgotha
    actually, Im looking to decrease the width-- screens are only so big on handhelds.
    Unfortunately, CSS is really the only way to set an absolute width on a <select> list. If you need to shorten the width, try detecting handhelds (server-side preferably) and abbreviating your option text, for example, by changing "New York" to "NY", etc.

  7. #7
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never that easy my friend, the list will be pulled from different dbs that can contain anything. I will come up with something, I always do

  8. #8
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Golgotha
    actually, Im looking to decrease the width-- screens are only so big on handhelds.
    Sorry, but I guess I did not understand the question...

  9. #9
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I read a question like this in another forum.
    You might would like to have a look there:

    http://www.echoecho.com/ubb/viewthread.php?tid=3097

  10. #10
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have to say, with no CSS and no control over the data in the options, you're probably kinda stuffed.

    Do tell if you figure something out

  11. #11
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by blufive
    I have to say, with no CSS and no control over the data in the options, you're probably kinda stuffed.

    Do tell if you figure something out [img]images/smilies/smile.gif[/img]
    I would also appreciate if you figure that out too....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •