The process of removing the underline is really that simple. Let¡¯s take a look at the code altogether, then check out how it looks on the front end.
Here¡¯s the CSS:
Order is important here ¡ª a:link and a:visited must come first, then a:hover, then a:active.
Here¡¯s the HTML:
Here¡¯s the result:
See the Pen by Christina Perricone () on .
It¡¯s also possible to toggle the underline to display only when the link is hovered and click. Do this with the rule text-decoration: underline; like so:
See the Pen by Christina Perricone () on .
How to Remove the Underline from Links in CSS in Bootstrap
The process to remove the underline from links differs slightly if you¡¯re using Bootstrap CSS in your project. Let¡¯s briefly discuss the process for Bootstrap sites.
By default in Bootstrap, links only show the underline when they are in hover or active state. Meaning, as a visitor hovers over or clicks on a link, it will show the underline. Otherwise, the underline will not show in links, even if they¡¯ve been visited. Also, links defined by the Bootstrap button class never show the underline.
-1.gif?width=650&name=Update%20remove%20underline%20from%20link%20css%20(light)-1.gif)
To remove the underline in links, no matter their state, you need to add some CSS.
Here¡¯s the CSS:
Here¡¯s the HTML:
Here¡¯s the result:
See the Pen by Christina Perricone () on .
Styling Links with CSS
Removing the underline in links is one of the most common questions from beginner front-end coders. The good news is the process is simple with the text-decoration property. You just need a little bit of knowledge of HTML and CSS to pull it off.
Editor's note: This post was originally published in July 2020 and has been updated for comprehensiveness.
Css
.gif?width=650&name=Update%20remove%20underline%20from%20link%20css%20(light).gif)