如何为asp:BulletedList链接分配预定义的样式

时间:2014-03-31 14:37:45

标签: html asp.net css bulletedlist

我的样式表中有一些链接样式:

a.whiteLinks {
    color: #FFFFFF;
    text-decoration: none;
}
a.blueLinks {
    color: #0076AC;
    text-decoration: none;
}
a.whiteLinks:hover {
    color: #5397AD;
    text-decoration: none;
}
a.blueLinks:hover {
    color: #5397AD;
    text-decoration: none;
}

我有以下asp:BulletedList

<asp:BulletedList DisplayMode="HyperLink" runat="server" ID="blFirst" ClientIDMode="Static">
     <asp:ListItem Value="allergy.aspx">Allergy and Immunology</asp:ListItem>
     <asp:ListItem Value="">Anesthesiology</asp:ListItem>
     <asp:ListItem Value="">Breast Surgery</asp:ListItem>
</asp:BulletedList>

我可以在哪里编辑,以便项目符号列表中的链接使用blueLink样式而不是默认样式?

我尝试在CssClass="blueLinks"中添加BulletedList,但它没有任何影响。

1 个答案:

答案 0 :(得分:1)

将课程更改为

.blueLinks li a {
   color: #0076AC;
   text-decoration: none;
}

并调整悬停,以便您也以正确的方式进行映射

 .blueLinks li a:hover {
     color: #5397AD;
     outline:none; /* add this. ASP has the bad habit of adding outline to links in IE */
     text-decoration: none; /* You don't need this.  */
  }

*YOUR FIDDLE *