Option in select on multiple lines?

Hi all
For design reasons I am wondering if this is possible? It is for a dynamically populated select field Thanks

Yes, you can use javascript to build a dynamic select element with dynamic <option> elements. You can also use the selection from one select element to populate the options in a second or subsequent select elements.

I have not come across any way that it can be done.

You can use CSS to set a maximum width for the select list but there is no way to get the entries that are too wide to display as one line to display as two lines as the content of the option cannot contain HTML and ignores all surplus whitespace (including any representation of a new line character).

You can only provide this type of thing by not using the traditional select and option html elements.

You do that by progressive enhancement: build your markup using select and option elements, then, by javascript code or server side code, you replace them with other html elements that have the ability to break their text content on more then one line and build the functionality for them to mimic the select and option elements behaviour.

Thank you for the replies really appreciated :slight_smile: