Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML <br /> inside a Select Box

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.

like image 425
Roch Avatar asked Jun 25 '26 10:06

Roch


2 Answers

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.

like image 116
kgiannakakis Avatar answered Jun 27 '26 22:06

kgiannakakis


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.

like image 24
Nikolas Stephan Avatar answered Jun 27 '26 23:06

Nikolas Stephan