Skip to content Skip to sidebar Skip to footer

Html Select Problem

I have some long text in a html select element. When a user selects one option the text is displayed as long as the select is. What is a best solution to make this usable and clear

Solution 1:

I usually truncate the display value (using ... suffix) so that it won't mess up the drop down list, then I set the actual long value as option title:-

<select><optionvalue="1"title="the brown fox jumped over the fence">the brown fox...</option>
    ...
</select>

Solution 2:

One option is to replace the <select> with a set of radio buttons / labels. You have more options for formatting the text, and it'll be easier to read.

Or, if don't need to have all the text in the select box, you could shorten the text on the options - maybe use javascript to populate another area on the page with a detailed description of the option they just selected.

Edit -- To lengthen the <select> box, you can set its css width with style="width:250px;", or whatever width you need. (Or put the style in a class, obviously)

Post a Comment for "Html Select Problem"