AskHandle

AskHandle Blog

Banishing the Underline from Hyperlinks with CSS

September 26, 2025Aria Singh3 min read

Banishing the Underline from Hyperlinks with CSS

Styling a website can be straightforward or detailed. A key element of web design is hyperlinks, commonly referred to as links. Many links have a default underline. This is useful for indicating clickable content, but sometimes your design may call for a different approach. Here’s how to remove the underline from hyperlinks using CSS.

Understanding the Default

Hyperlinks come with an underline by default. Web browsers apply this style to help users easily identify clickable text. While this is functional, it may not suit your website's design.

Quick and Easy: Inline CSS

For quick fixes, you can remove the underline with inline CSS. For example, consider the following link:

html
1<a href="https://www.example.com">Click Here</a>

To remove the underline, add the style attribute:

html
1<a href="https://www.example.com" style="text-decoration: none;">Click Here</a>

Using text-decoration: none; removes the underline. This method is fast but can be tedious for numerous hyperlinks.

Cascading Style Sheets to the Rescue

To efficiently remove underlines everywhere, use an external stylesheet. This file, often called styles.css, allows you to define styles for multiple elements.

First, connect your stylesheet in the <head> section of your HTML:

html
1<link rel="stylesheet" href="styles.css">

Then, in your styles.css file, add the following rule:

css
1a {
2    text-decoration: none;
3}

Now, all hyperlinks on your website will be free of underlines.

If you want to remove the underline selectively, use classes. Define a class for specific links:

html
1<a href="https://www.example.com" class="no-underline">No Underline Here</a>

In your CSS:

css
1.no-underline {
2    text-decoration: none;
3}

Only links with the class no-underline will have the underline removed.

Pseudo-classes and Interaction

Sometimes you may want to remove the underline based on link states like hover or visited. Use CSS pseudo-classes like :hover and :visited:

css
1a:hover, a:visited {
2    text-decoration: none;
3}

This prevents the underline from appearing when a user interacts with a link.

Accessible Design

Underlines serve as an accessibility feature, helping users identify clickable text. If you remove them, consider alternative styles to enhance visibility. Techniques such as color changes, font weight adjustments, or borders can help.

For instance, you could use bold text on hover:

css
1a:hover {
2    font-weight: bold;
3}

Or add a bottom border on hover:

css
1a:hover {
2    border-bottom: 2px solid currentColor;
3}

When styling your website, think carefully about link designs. The default underline is common, but you can customize your hyperlinks creatively using various CSS properties.

Removing the underline from hyperlinks with CSS is straightforward. Whether you use inline styles for quick adjustments or external stylesheets for broader changes, CSS gives you control over how hyperlinks look.

Balancing aesthetics with usability will create a better experience for your site visitors.