Open In App

How to Remove Underline for Anchors Tag Using CSS?

Last Updated : 05 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In HTML, anchor (<a>) tags are used to define hyperlinks, and by default, most browsers display them with an underline to signify that they are clickable. While this is the standard behavior, you may want to remove or customize the underline for design purposes.

The simplest way to remove the underline from anchor links is to use the text-decoration property in CSS. By setting it to none, you can easily eliminate the default underline style.

a {  
text-decoration: none;
}

This rule removes the underline from all anchor (<a>) tags on the page.

Example 1: In this example, we include two links styled with the text-decoration property. The second link, with ID GFG, has no underline due to text-decoration: none.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        text-decoration property
    </title>

    <style>
        body {
            text-align: center;
        }

        h1 {
            color: green;
        }

        #GFG {
            text-decoration: none;
        }
    </style>
</head>

<body>

    <h1>GeeksForGeeks</h1>
    <h3>Original Link</h3>
    <a href="#">Link 1</a>
    <br>
    <h3>removed Underline</h3>
    <a id="GFG" href="#">Link 2</a>
</body>

</html>

Output:

Example 2: In this example we styles an anchor link with an underline by default. On hover, the underline is removed. The text-decoration changes are applied to the link element.

html
<html>
<head>
    <style>
        body {
            text-align: center;
        }

        h1 {
            color: green;
        }

        a:link {
            text-decoration: underline;
        }

        a:hover {
            text-decoration: none;
        }
    </style>
</head>

<body>
    <h1>GeeksforGeeks</h1>
    <a id="GFG" href="#">GeeksforGeeks Anchor Part</a>
</body>

</html>

Output:

frt

Customizing the appearance of hyperlinks can significantly enhance the user experience on your website. By using the text-decoration property in CSS, you can easily remove the underline from anchor tags, either permanently or conditionally (such as on hover).


Article Tags :

Similar Reads