【发布时间】:2019-04-13 05:12:07
【问题描述】:
单选按钮之间的间隙具有固定宽度,并且文本向下。 asp:ListItem 不允许使用 div 或 label 元素。我想根据文字设置asp:ListItem的宽度。我可以使用inspect source 编辑宽度,但我不知道如何为 Visual Studio 中的每个列表项指定宽度。我是 C# 的初学者,有人可以帮我怎么做吗?
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem >Add</asp:ListItem>
<asp:ListItem>Clear all lines of code</asp:ListItem>
<asp:ListItem Selected="True">Do nothing</asp:ListItem>
</asp:RadioButtonList>
【问题讨论】:
-
<asp:ListItem class="whatever">然后在 CSS 文件中.whatever { width: 100px }并将 100px 更改为适合您的任何值。如果你不懂CSS,请上网搜索。 -
不允许“类”属性。我不能在 中使用任何 css 类<asp:ListItem> -
抱歉,请使用
CssClass而不是class