views:

488

answers:

2

select,option{text-align:center;}

works in FF, but not in IE(at least 8.0), how could I make sure that the text align in the center for IE8.0? Thanks!!!

A: 

Unfortunately, you can't change the alignment of SELECT items in IE, although it surprises me that even IE 8 keeps this bad habit.

Pekka
no way around?!
WilliamLou
A: 

Given that this is not possible in IE, I think you would have to resort to:

  1. Implementing your own SELECT widgets. There are many JS libraries that do this, mostly because SELECT inputs are hard to style.

  2. Insert the appropriate whitespace in front of the smaller options.

Edit: looks like whitespace doesn't work, but HTML space does:

<SELECT>
   <OPTION>&nbsp;&nbsp;&nbsp;SMALL</OPTION>
   <OPTION>&nbsp;&nbsp;LARGER</OPTION>
</SELECT>

That's quite a hack...

Chase Seibert
Whitespace doesn't work, IE appends them to the right hand side of the item - for whatever reason...
Pekka