【问题标题】:How to assign a pre-defined style to a asp:BulletedList link如何将预定义样式分配给 asp:BulletedList 链接
【发布时间】:2014-03-31 14:37:44
【问题描述】:

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

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 样式而不是默认样式?

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

【问题讨论】:

    标签: html asp.net css bulletedlist


    【解决方案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 *

    【讨论】:

    • 我也在我的页面上为我的a 链接使用相同的样式,并希望这个特定的项目符号列表具有相同的样式。我从a.blueLinks 更改为.blueLinks 无济于事。仍然没有改变风格。
    • 你能把html和css提取出来放在fiddle里吗?您是否静态地尝试过(在 ASP 之外)。我很确定可以通过以正确的方式映射特异性路线来完成。如果不知道周围还有什么,很难说出来
    • jsfiddle.net/pAuPL 因为它是 ASP 代码,所以它不会正确呈现,我会检查它是否在没有 ASP 的情况下工作......
    • 对,需要粘贴源代码。在浏览器中运行它并在源代码中找到问题区域,将其粘贴到小提琴中。
    • 它将为使用该类的列表中的每个链接。如果您希望它适用于所有链接,只需将该类中的这些属性添加到 a { code here } 所在的 reset.css 中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 2019-08-23
    相关资源
    最近更新 更多