gpt4 book ai didi

css - 为选项设置 DropDownListFor CSS

转载 作者:行者123 更新时间:2023-11-28 13:48:25 27 4
gpt4 key购买 nike

我有以下设置我的下拉菜单到荒谬的宽度:

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

如何获取在填充的下拉列表中显示为选项的元素以移动它们的对齐方式,例如居中对齐文本?

这就是我的目标,我认为应该的工作,可以找到here .

Center dropdown item text

但是如您所见,选项文本仍然在左侧。有什么想法吗?

最佳答案

你想要这样的东西吗?

My Fiddle

My New Fiddle

此外,注意,您使用的是 500 像素的宽度,这是为了什么?

关于css - 为选项设置 DropDownListFor CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11634200/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com