0

This text "Third OMG! How can one option contain soooo many words? This really is a lot of words." make my Select box width more than 300px.

<form action="" method="get">
<select name="monster-widget-just-testing">
<option value="0">First
</option><option value="1">Second
</option><option value="2">Third OMG! How can one option contain soooo many words? This really is a lot of words.
</option></select>
</form>

View the demo in here > http://jsfiddle.net/VHf9r/

How to make the box width box always 300px with that text???

Please help me.

Thank you

2 Answers2

1

The following CSS works in all of the main browsers except for Google Chrome. I don't know about a solution for chrome but yes this works:

#myselect { 
width:300px; 
} 
#myselect option { 
width:300px; 
}

Just append the myselect id to the select element like so:

<select id="myselect" name="monster-widget-just-testing">

More about this here: Set width of dropdown element in HTML select dropdown options

Here is a jsFiddle:

http://jsfiddle.net/sVv6x/

To OP: This will not work in Google Chrome, however it does work in Firefox and other browsers (I have just tested it and it works O.K)

Community
  • 1
  • 1
adaam
  • 3,700
  • 7
  • 27
  • 51
0

Or this one: .widget_text select { min-width: 300px; }

Thomas Fonseca
  • 542
  • 4
  • 12