如何在DropDownList中为ListItem设置对齐方式? [英] How can I set alignment for a ListItem in a DropDownList?

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

问题描述

我的aspx文件中有一个DropDownList,如下所示:

 < asp:DropDownList runat =serverID = 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中呈现如下:





我如何设置对齐方式所有ListItems都要在右边,使得值正确对齐?
我试图在DropDownList和ListItems上设置style =text-align:right,但是没有任何效果。
我需要一个也适用于 Chrome 的解决方案。



感谢您的回复!

解决方案

添加以下样式将根据需要对齐数字,但将向下箭头移动到左侧而不是右侧。



除了使用这个,我认为无法对齐选择选项可能是Chrome中的限制。

 。下拉列表
{
direction:rtl;
}


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>

In Chrome it renders like this:

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.

Thanks for replies!

解决方案

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

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中为ListItem设置对齐方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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