0

I have the following that sets my dropdown to a ridiculous width:

<div class="editor-field">
  @Html.DropDownListFor(x => x.TypeId, new SelectList(Model.Type, "TypeId", "TypeName"), null, new {  @style = "width: 500;" })
                                </div>

How do I get the items that appear as options in the populated drop down to move their alignment e.g. center align the text?

This is what I am aiming for, what I think should work, which can be found here.

Center dropdown item text

But as you can see, the option text is still over to the left. Any ideas?

tereško
  • 57,247
  • 24
  • 95
  • 149
Ricardo Deano
  • 2,701
  • 8
  • 45
  • 70

2 Answers2

0

Do you want something like this?

My Fiddle

My New Fiddle

Also NOTE, you are using 500px width, what's that for?

Mr. Alien
  • 147,524
  • 33
  • 287
  • 271
0

I am not quite sure what is you goal here is.

But if I understood correct

<select class="ddl">
    <option>Option1</option>
    <option>Option2</option>
</select>

css

.ddl{text-align: center; width:250px;}
option{text-align: center;}

Sample : Click Here

huMpty duMpty
  • 14,061
  • 13
  • 55
  • 93