CSS Introduction

CSS Tutorial What is CSS CSS Syntax CSS Selector How to include CSS CSS Comments

CSS Attributes

CSS Background CSS Border CSS Display CSS Float CSS Font CSS Color CSS Hover CSS Important CSS Line-height CSS Margin CSS Opacity CSS Filter CSS Images CSS Overflow CSS Padding CSS Position CSS Vertical align CSS White space CSS Width Word-wrap in CSS Box-shadow in CSS Text-transform in CSS CSS Outline CSS Visibility CSS Counters CSS Clear fix CSS Icons CSS Justify-content Text-decoration in CSS CSS Lists CSS nth selector CSS Sticky CSS Background-clip CSS Checkbox-style CSS Letter-spacing CSS Navigation bar CSS Overlay CSS Root CSS Specificity CSS Text-indent CSS Text-stroke CSS Zoom CSS Order CSS Descendent selector CSS Clip CSS calc() CSS Background-blend-mode CSS radio-button CSS Superscript and subscript CSS Text-effects CSS Text-align CSS Variables CSS Page-break-before CSS Page-break-inside CSS Page-break-after CSS Content property CSS Word-spacing CSS Animation CSS @keyframes rules CSS Pseudo-classes CSS Pseudo-elements CSS Radial-gradient CSS Translate CSS Gradients CSS z-index CSS Loaders CSS Units CSS Transition CSS Masking CSS Arrow CSS Pagination

Questions

What is Bootstrap CSS What is CSS used for How to center a table in CSS What is a CSS File How to center a button in CSS How to change background color in CSS How to change the font in CSS How to change font size in CSS How to resize an image in CSS How to get rid of bullet pioints in CSS Is CSS a programming language How to edit CSS in WordPress How to use google fonts in CSS How to create blinking text using CSS How to Set Space between the Flexbox Is CSS a Programming Language

Difference

Difference between HTML and CSS Grid Vs Flexbox in CSS Difference between CSS Grid and CSS Flexbox

Misc

Create a 3D text effect using HTML and CSS Hover condition for a:before and a:after in CSS Bem CSS Boder Types CSS Features of CSS Font Face CSS Image Overlay CSS B Tag CSS Carousel CSS CSS Arrow CSS Focus Flex Grow in CSS Bem CSS Features of CSS Font Face CSS Removing Underline from Link in CSS Width Property in CSS Radio Button in CSS

Removing Underline from Link in CSS

If we work as web developers, we may have wished to eliminate the underlining that automatically displays when we add a link to a page.

Fortunately, we can design the anchor tags responsible for displaying a link, just like other components on a web page.

In this post, we'll demonstrate how to use CSS to remove the underlining from a link. We'll also demonstrate how to remove the underline for each of the four states where links may exist. Links in browsers, by default, have an underline.

If we've already been to the page the link leads to, it additionally adds the colors blue and purple.

Using CSS, you may link underlining disappear by adding text-decoration: none to your code.

Remove the Underline from the Link CSS

The textual connections are colored and highlighted to draw the eye, just as most paintings are framed to improve their look and for aesthetic reasons. The HTML/CSS standards specify that clicked hyperlinks should always be underlined. This enhances the web pages' clickability and interaction and serves various functions. Examples of this service include E-commerce websites, search engine display sites, communication channels, encyclopedias, news portals, video libraries, index pages, and other online services.

Additionally, suppose you are a front-end web designer who dislikes the appearance of your unique website due to ununiform text or are simply trying to eliminate the irregularities brought on by underlined hyperlinks. In that case, this article will precisely illuminate the solutions for you.

What Links Do in CSS?

An object that connects online pages or a portion inside a single web page is known as a link or hyperlink. The "href" property of a hyperlink in HTML is used to specify its destination site. Additionally, the HTML standard has specified the textual hyperlink to remain highlighted regardless of the status of the link. In this case, links can only be in one of the four possible states (visited, hovering, unvisited, or active link state) at once in any known browser. However, several CSS style methods may overcome this standard restriction.

As a result, CSS properties are used to style hyperlinks. Furthermore, creating pseudo-classes may stylize the various states of a link. The following parts will explain element selection and pseudo-classes.

How do I choose the link CSS element?

We have two options: execute a general element selection or specify unique style characteristics for each class. The four states of a connection are depicted in the table below:

Additionally, the most helpful CSS attributes for modifying links are listed below with the following sample values: 

  • Color: Crimson;
  • Font-family: Calibri;
  • Text-decoration: none;
  • Background-color: Cyan;

How can I Use CSS to Remove the Underline from the Anchors Tag?

The anchor element defines hyperlinks; by default, it shows the underlined anchor portion. Utilizing the text-decoration attribute makes removing the underline simple. The CSS text-decoration property enables text to be decorated as needed. To remove the underline from the anchor element, set text-decoration to none.

Syntax:

text-decoration: none;

Example 1: The text-decoration property is set to none in this example.

<!DOCTYPE html> 

<html>

<head>

<title>

Example of text-decoration property

</title>

<!-- text-decoration property to remove

underline from anchor tag -->

<style>

#main {

text-decoration: none;

}

</style>

</head>

<body style = "text-align:left;">

<h1 style = "color:red;" >

Welcome

</h1>

<h3>First Link</h3>

<a href = "#">Link 1</a>

<br>

<h3>Removed Underline</h3>

<a id = "main" href = "#">Link 2</a>

</body>

</html>

Output

Removing Underline from Link in CSS

Example 2: When the mouse is above the anchor portion, utilize the hover property to remove the underlining.

<!-- HTML code to remove underline 

from anchor tag -->

<!DOCTYPE html>

<html>

<head>

<title>

Example of text-decoration property

</title>

<!-- text-decoration property to remove

underline from anchor tag -->

<style>

a:link {

text-decoration: underline;

}

a:hover {

text-decoration: none;

}

</style>

</head>

<body style = "text-align:left;">

<h1 style = "color:red;" >

Welcome

</h1>

<a id = "main" href = "#">Welcome Anchor Part</a>

</body>

</html>

Output:

Before the mouse moves over:

Removing Underline from Link in CSS

After the mouse moves over:

Removing Underline from Link in CSS

Conclusion

In conclusion, customizing links to display correctly is highly wanted to avoid confusion for anyone attempting to reach our websites. The user experience is ruined by poorly designed web links, which may be remedied by modifying the default settings. We used the text-decoration CSS property by choosing the <a> tag and changing its value to none.