Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I would like to know how to remove the underline of a hyperlink text. Hereunder is my code:

XML
<asp:HyperLink ID="HyperLink1" NavigateUrl="~/registration.aspx" runat="server"
        style="z-index: 1; top: 173px; position: absolute; height: 26px; width: 110px; left: 1081px;">New registration</asp:HyperLink>


Beneath 'New registration' the underline that appears on the screen has to be removed.
Can any one advice.

Regards.
Posted

Handle it in your style sheet. Add the following

CSS
#HyperLink1
{
  text-decoration: none;
}


This will remove the underline from your hyper link for this specific ID
 
Share this answer
 
Comments
Sriyashree Swain 13-Jul-18 2:31am    
I am creating link button dynamically in placeholder inside a gridview and how can i remove underline from it?
David_Wimbley 13-Jul-18 12:28pm    
Did you read the answer i posted? If its not working check your css selector as its probably incorrect. That or attach a class to your buttons so you can target the class.
Add CssClass property to hyperlink

XML
<asp:HyperLink ID="HyperLink1" NavigateUrl="~/registration.aspx" runat="server" CssClass="hyp">New registration</asp:HyperLink>


XML
<style type="text/css">

        .hyp
        {
            text-decoration:none;
            z-index: 1;
            top: 173px; 
            position: absolute;
            height: 26px;
            width: 110px;
            left: 1081px;
        }
    </style>
 
Share this answer
 
v2
You can add this in the <asp:HyperLink> too, something like this:

<asp:HyperLink ID="HyperLink1" runat="server" Font-Underline="false" />

Hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900