ITsolutionWizard
asked on
html5 select
i have extremely option text in the last option and I want to limit to width to 200px.
How can I do that?
<select>
<option value="value1">value1</opt ion>
<option value="value2">value2</opt ion>
<option value="extremely_long_valu e3">extrem ely_long_v aluesdfgsd fgsdgsdgsd fgsdfgsdfg sdfgsdfgsd fsdfsdfgsd fsdfsdfsdf fagsgfadsf gsdfgsdfgs df3</optio n>
</select>
How can I do that?
<select>
<option value="value1">value1</opt
<option value="value2">value2</opt
<option value="extremely_long_valu
</select>
<select id="myselect">
css:
#myselect{width:200px; text-overflow: ellipsis;}
css:
#myselect{width:200px; text-overflow: ellipsis;}
ASKER
no. I want to limit the <option> not the <select>.
It is just one of the <option> is too long/width
It is just one of the <option> is too long/width
well then instead of:
<select id="myselect">
use:
<option id="myoption">
css:
css:
#myoption{width:200px; text-overflow: ellipsis;}
<select id="myselect">
use:
<option id="myoption">
css:
css:
#myoption{width:200px; text-overflow: ellipsis;}
ASKER
not working
select boxes are usually the width of it's longest option, unless otherwise specified. So you would need to specify a width for the select box, as Misbah suggested.
I Just tested it on jsfiddle and it works.
What browser do you use?
What browser do you use?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window