Discussion:
Multiple select box line wrap
Paul Collins
2010-02-16 15:22:28 UTC
Permalink
Hi all

I'm have a fixed width on a multiple select box. The problem is, some of the
options are longer than the width and by default the lines won't wrap. I'm
wondering if anyone has seen a way of making lines wrap using either CSS or
JQuery. I've added a title to each option, so you can get the full content
if you hover over an item, but really need the text to wrap.

Here's how the HTML code looks:

<select multiple="multiple">
<option title="Item 1 - brief description lorem ipsum dolor sit amet
consectateur adipscing elit.">
Item 1 -
brief description lorem ipsum dolor sit amet consectateur adipscing
elit.
</option>
<option title="Item 2 - brief description lorem ipsum dolor sit amet
consectateur adipscing elit.">
Item 2 -
brief description lorem ipsum dolor sit amet consectateur adipscing
elit.
</option>
<option title="Item 3 - brief description lorem ipsum dolor sit amet
consectateur adipscing elit.">
Item 3 -
brief description lorem ipsum dolor sit amet consectateur adipscing
elit.
</option>
</select>

Would appreciate any help.
Cheers
Paul
Nathan Klatt
2010-02-16 16:34:15 UTC
Permalink
Post by Paul Collins
I'm have a fixed width on a multiple select box. The problem is, some of the
options are longer than the width and by default the lines won't wrap. I'm
wondering if anyone has seen a way of making lines wrap
Multiple selects are a HTML/CSS/browser weakness.

My recommendation is to use checkboxes, styled so they highlight when
:selected and the box doesn't show, named as an array, e.g.,
name="multiSelect[]"; put them all in a ul or ol and make wrapping
easy.

Nathan
Paul Collins
2010-02-16 17:29:30 UTC
Permalink
Thanks Nathan

That's a good idea actually, guess that would work even if you had scripts
turned off...

Will put that to use, thanks again.
Post by Nathan Klatt
Post by Paul Collins
I'm have a fixed width on a multiple select box. The problem is, some of
the
Post by Paul Collins
options are longer than the width and by default the lines won't wrap.
I'm
Post by Paul Collins
wondering if anyone has seen a way of making lines wrap
Multiple selects are a HTML/CSS/browser weakness.
My recommendation is to use checkboxes, styled so they highlight when
:selected and the box doesn't show, named as an array, e.g.,
name="multiSelect[]"; put them all in a ul or ol and make wrapping
easy.
Nathan
--
------------------------------------------------------
Porfolio: paulcollinslondon.com
Twitter: twitter.com/paulcollins
Nathan Klatt
2010-02-16 17:41:26 UTC
Permalink
'Course it's a good idea!

;)
Post by Paul Collins
Thanks Nathan
That's a good idea actually, guess that would work even if you had scripts
turned off...
Will put that to use, thanks again.
Continue reading on narkive:
Loading...