views:

200

answers:

3

I would like to know if there is anyway I can divide an item on two line inside a select box.

One of the values of my select box is two long to fit in my div.

+7  A: 

No, this is impossible.

You can consider using a javascript widget, like this jQuery plug-in.

May I also say that what you are trying to do is uncommon - even in desktop applications users don't expect to find wrapped text in a drop-down box and may get confused if they do see one. It would be better to try a different control or try to limit the text.

kgiannakakis
+2  A: 

It is impossible, but if it's simply a matter of avoiding that the element gets too wide you could just define a width (eg. <select style="width:100px;">). This will cause text to be cut off when the box is "closed", but as soon as you "open" it the entire text will be shown.

Nikolas Stephan
Setting a fixed width on select will make it hard to read options longer then that width in IE.
anddoutoi
+1  A: 

As far as I know, it's impossible. However, I'd look at jQuery for options. Specifically, there are jQuery plugins that allow for select box customization.

Select Box Factory 2.0 is one option. I believe it extends the functionality of the select box to allow text wrapping among other features.

T Pops