0

This question shares my problem, I tried the answer but it didn't work

#SelectBoxid {
  width:150px; 
}
 #SelectBoxid option{
   width:150px; 
}

Any way to make the option same width as select and if there is more text it can be just ...

UPDATE

Pure css as much as possible no jquery..

FIDDLE

Community
  • 1
  • 1
Brownman Revival
  • 3,620
  • 9
  • 31
  • 69

1 Answers1

0

After doing some research, I don't think it's possible to control option's width without javascript. Its width depends on browser implementation.

There isn't a way to control this width in HTML standards. http://www.w3.org/TR/html-markup/option.html#option

And support for CSS on form controls is rather weak.

This style is useless. It doesn't control option at all. If options are all short, then options' width are the same as select even you set width to 100px. If any option is wider than select, then options' width are the same as the widest option. (at least in Chrome)

#category option {
  width:173px; // not works at all
}
gzc
  • 8,180
  • 8
  • 42
  • 62