如何设置调整为一个DropDownList一个列表项? [英] How can I set alignment for a ListItem in a DropDownList?

查看:121
本文介绍了如何设置调整为一个DropDownList一个列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在aspx文件一个DropDownList这样的:

I have a DropDownList in my aspx file like this:

<asp:DropDownList runat="server" ID="MaxRec">
  <asp:ListItem>10</asp:ListItem>
  <asp:ListItem>50</asp:ListItem>
  <asp:ListItem>100</asp:ListItem>
  <asp:ListItem>150</asp:ListItem>
  <asp:ListItem Selected="True">200</asp:ListItem>
</asp:DropDownList>

在Chrome浏览器它呈现这样的:

In Chrome it renders like this:

如何设置上的所有ListItems的对齐方式是正确的,这样值正确对齐? 我尝试设置样式=文本对齐:右的DropDownList的并在ListItems的,​​但它没有任何影响。 我需要一个解决方案,也适用于 Chrome浏览器

How can i set the alignment on all ListItems to be to the right so that values are properly aligned? I tried setting style="text-align:right" on the DropDownList and on the ListItems but it doesn't have any effect. I need a solution that also works on Chrome.

感谢您的答复!

推荐答案

添加以下样式根据需要将调整的数字,但将移动下拉箭头向左,而不是正确的。

Adding the following style will align the numbers as required but will move the drop down arrow to the left instead of the right.

除了使用该我承担无法右​​对齐选择选项可在Chrome的限制。

Other than using this I assume the inability to right align select options may be a limitation in Chrome.

.drop-down-list
{
    direction: rtl;
}

这篇关于如何设置调整为一个DropDownList一个列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆