更改链接按钮的颜色和下划线

Changing color and underline the content of link button

本文关键字:颜色 下划线 按钮 链接      更新时间:2023-09-26

我想更改颜色,并在数据列表的项目模板中放置的链接按钮的内容下加下划线,仅选中按钮

下面是我的代码,用于设置链接按钮

<asp:DataList ID="DlPaging" runat="server" BorderWidth="0" RepeatDirection="Horizontal">
  <ItemTemplate>
     <asp:LinkButton CssClass="pagenav" ID="LnkBtnPage" OnClientClick="clickfire(this.id);" runat="server" Visible="true">
        <%# Container.ItemIndex +1 %>
     </asp:LinkButton>
        <%--   <asp:Label runat="server" ID="LblPage" CssClass="pagenav2" Font-Bold="True" Visible="true"
                       Text='<%# Container.ItemIndex +1 %>'>
               </asp:Label>
        &nbsp;--%>
 </ItemTemplate>
 </asp:DataList>

使用CSS可以轻松完成您想要的内容。

.pagenav:hover {
    text-decoration: underline;
    color: blue;
}