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
  • 58,060
  • 25
  • 98
  • 150
Ricardo Deano
  • 2,769
  • 8
  • 47
  • 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
  • 153,751
  • 34
  • 298
  • 278
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,346
  • 14
  • 60
  • 99