How to adjust window width DropDown <select>?

I need to adjust the width of the HTML select box without using css, is there any way? I tried the size, but then it adjusted the height, and the width did nothing? Is there another way?

+6
html xhtml
source share
4 answers
<style type="text/css"> select { width:200px; } </style> 

Does this work?

+6
source share

There is no way to do this in pure HTML at http://www.w3.org/TR/html401/interact/forms.html#h-17.6 . You can set it using a style element, although it does not have CSS because it is inline.

 <select style="width: .... 
+12
source share

Add an empty option with enough spaces in it ...

+1
source share

If you use jquery, math, physics, chemistry, chemistry

This is my HTML code. So you need to add another div that contains the jquery class name, including the name of your class, and apply the height and width in your class.

 <div class="ui-select selBox"> <select> <option>Maths</option> <option>Physics</option> <option>Chemistry</option> </select> </div> .selBox{ width: 470px !important; height: 40px !important; } 

here selBox is my class name and ui-select is the jquery class name.

0
source share

All Articles