【发布时间】:2012-12-06 21:19:23
【问题描述】:
所以我正在做一些我认为应该如此简单的事情。
我有一个想要设置样式的 <asp:ListBox /> 元素,因为我认为默认设置看起来很可怕,尤其是边框。
但似乎很少有属性在 CSS 中生效,最明显的是无法移除边框。
需要注意的是,我需要它在 IE8 和 IE7 中工作,而不仅仅是其他更现代的浏览器。
This example site 有漂亮的列表框元素,但我无法靠近它们。
有什么想法吗?
这是 HTML:
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple" AutoPostBack="true"
onselectedindexchanged="ListBox1_SelectedIndexChanged" CssClass="myListBox" >
<asp:ListItem>ITEM 1</asp:ListItem>
<asp:ListItem>ITEM 2</asp:ListItem>
<asp:ListItem>ITEM 3</asp:ListItem>
<asp:ListItem>ITEM 4</asp:ListItem>
</asp:ListBox>
还有 CSS:
.myListBox
{
border-style:none;
border-width:0px;
border: none;
font-size:12pt;
font-family:Verdana;
}
【问题讨论】:
标签: asp.net css listbox styling