Wrapping text in a select box
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.
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:
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:
<option value="This is a rather long selection text">This...selection text</option>
<option value="Cinnaminson, New Jersey, United States">Cinnaminson, NJ, USA</option>
<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
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Originally Posted by Superfly1611
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.
Which I think is similar to what NogDog has just posted.
<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>
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)