0

I am using a select box in my codes which contains 50 options, by default when I click on it, drop down menu appears like below:

<select name="Select1" style="width: 56px">
 <option></option>
 <option>1</option>
 <option>2</option>
 <option>3</option>
 <option>4</option>
 <option>5</option>
 </select>

enter image description here

but I want it to appears like a table:

enter image description here

I tried some CSS and JS but didn't work, is there any way to do this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sina Nouri
  • 111
  • 3
  • 13

1 Answers1

1

With just a <select> element, no . . . HTML select boxes are some of the most limited, when it comes to cross-browser support for styling. Even the most "flexible" browser are extremely restrictive on what they let you change (some font styling, some color support, sizing and spacing is about the most you should expect to get).

If you have to have a table-like structure, you are limited to using libraries or building a custom interface that mimic a dropdown (usually using styled divs and some flavor of "show/hide" or "slide" animation). Here is another similar SO thread that has MANY suggestions to choose from: Is it possible to style a select box?

Community
  • 1
  • 1
talemyn
  • 7,822
  • 4
  • 31
  • 52