jquerycssasp.netlinklabel

ASP.NET giving style to Linklabel


I'm a novice at asp.net and I want to give style to a linklabel. My code as follows:

<asp:LinkButton ID="lnkUser" runat="server" CssClass="userlabel">Guest</asp:LinkButton>
.userlabel {
    display:inline-block;
    text-decoration: underline;
    background-color:coral;
}

I am suspicious about jQuery overrides Site.css code. Is it possible? What am I doing wrong?


Solution

  • You can use !important in css

    <asp:LinkButton ID="lnkUser" runat="server" CssClass="userlabel">Guest</asp:LinkButton>
    

    Will render in html as:

    <a id="lnkUser" class="userlabel" href="javascript:__doPostBack('lnkUser','')">Guest</a>
    

    So you can add style for that like bellow to give importance

    a.userlabel {
        display:inline-block !important;
        text-decoration: underline !important;
        background-color:coral !important;
    }