Control de width of a SelectBox

Discussion in 'HTML & Website Design' started by xomero, Sep 24, 2008.

  1. #1
    Hi, how can I FULL-control the width of a <select> item.?

    I use something like:

    <select name="a" style="width:150px">
    ..
    </select>

    With a Verdana font the option list with less than 26 chars (aprox) looks good, but when an option with 27 chars comes the select get bigger and is not following the css (of 150px and get like 160px that make my left bar bigger, and all my design get moved.

    I was trying something with te "!important" tag but nothing happens.
     
    xomero, Sep 24, 2008 IP
  2. PeachyDandy

    PeachyDandy Peon

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I hope this is what you are referring to; you can create it in your website stylesheet.

    You need to use maxlength to stop text from going over a certain amount of characters. So

    Read more here: quirksmode.org/dom/maxlength.html
     
    PeachyDandy, Sep 24, 2008 IP
  3. xomero

    xomero Member

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    the <SELECT> not supports MAXLENGTH property
     
    xomero, Sep 26, 2008 IP
  4. LindseyInteractive

    LindseyInteractive Well-Known Member

    Messages:
    2,830
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    175
    #4
    As mentioned above, I would go to make your width a bit larger if able to so that you can fit more char inside the <SELECT> option. Or if this is not possible try to reduce your font so that there is not as much pixels per char.
     
    LindseyInteractive, Sep 26, 2008 IP