www.webdeveloper.com
Results 1 to 4 of 4

Thread: Wrapping text in a select box

  1. #1
    Join Date
    Sep 2003
    Posts
    78

    Wrapping text in a select box

    Hello all,

    I'm looking for a way to wrap the text onto multiple lines in an option for a multi line SELECT box if the text is too wide for the width of the select box.

    Is this possible?
    I need a solution that is IE compatable, ff compatability would be a nice bonus.

    Many Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,313
    I'm not aware of a way to wrap the option text. The only practical solution I've run across is to ellide and/or abbreviate some of the text, then set the full value in the tag:
    Code:
    <option value="This is a rather long selection text">This...selection text</option>
    <option value="Cinnaminson, New Jersey, United States">Cinnaminson, NJ, USA</option>
    You could split the text across two options, setting the full value in each tag, but that might be confusing to the user since only one of the lines could be selected:
    Code:
    <option value="This is a rather long selection text">This is a rather...</option>
    <option value="This is a rather long selection text">...long selection text</option>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Sep 2004
    Posts
    361
    Quote Originally Posted by Superfly1611
    Hello all,

    I'm looking for a way to wrap the text onto multiple lines in an option for a multi line SELECT box if the text is too wide for the width of the select box.

    Is this possible?
    I need a solution that is IE compatable, ff compatability would be a nice bonus.

    Many Thanks

    My question is why do you need this?
    Maybe a more detailed description of what yiou are trying to would be in order.
    Maybe someone will then post a solution.

    Now a possibble solution would be to use the entire string of text in the value but use a shorter description of it fot the label part.

    HTML Code:
    <option value="This is a rather long selection text that goes on forever here its too big to show in the label">This text describes the value in 3 or 4 words</option>
    Which I think is similar to what NogDog has just posted.

    -Bill

  4. #4
    Join Date
    Sep 2009
    Posts
    1

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles