user2174247
user2174247

Reputation: 21

How can I apply table structure to select box options in HTML

In my select box options, each option having three words.Now I want apply fixed widths for each word of the option so that the all options will come as i required for example My options are as follows :

1,   aaaaa bbbbb ccccccccc
2,   aaaaaaaa bbbbbbb cccc     
3,   aaaaaa bbbbb cccc 

but i want to display these options in the dropdown as

1,   aaaaa     bbbbb     ccccccccc
2,   aaaaaaaa  bbbbbbb   cccc     
3,   aaaaaa    bbbbb     cccc 

help me if anyone know how to do this

Upvotes: 2

Views: 4195

Answers (3)

Hamid Talebi
Hamid Talebi

Reputation: 1318

you can use div and CSS style .See this sample that i wrote in jsfiddle.net
See example

Upvotes: 3

isherwood
isherwood

Reputation: 61092

Another option might be to use a third-party JavaScript library to restructure the select box and add styling as needed.

http://ivaynberg.github.com/select2/

Upvotes: 1

isherwood
isherwood

Reputation: 61092

One possibility would be to 1) apply a monospace font to select options, and 2) use JavaScript to make sure each element of an option has the same number of characters by adding trailing spaces as needed, either to some arbitrary length or to the length of the longest element.

Upvotes: 1

Related Questions