Change CSS Link Color: A Comprehensive Guide

Andrew Jul 31, 2026

Changing the color of a link in CSS can significantly enhance the look and feel of your webpage, improving its aesthetic appeal and usability. This style alteration can draw users' attention, making it an essential aspect of web design. Let's explore how to change the color of linked text in CSS.

How to Change Hyperlink Color HTML or CSS
How to Change Hyperlink Color HTML or CSS

CSS provides various properties to style and customize link colors. The most commonly used are 'color' and 'text-decoration'. The 'color' property sets the color of the text, and 'text-decoration' can be used to remove or customize the underline style of the link.

How to Edit WordPress Link CSS and Styles - WPArena
How to Edit WordPress Link CSS and Styles - WPArena

Changing the Color of Normal Links

To change the color of normal, unvisited links, you can use the 'color' property alongside the ':link' pseudo-class:

How to Change the Link Color in WordPress (Beginner's Guide)
How to Change the Link Color in WordPress (Beginner's Guide)

&:link { color: blue;}\n

This CSS rule will set the color of all unvisited links on your webpage to blue.

How to Dynamically Change the Colors of Product Images using CSS Blend Mode and SVG | Codrops
How to Dynamically Change the Colors of Product Images using CSS Blend Mode and SVG | Codrops

Styling Visited Links

The ':visited' pseudo-class can be used to change the color of links that the user has already clicked on:

&:visited { color: green;}\n

How to change the color of the selection?
How to change the color of the selection?

This rule will make all visited links appear in green.

Changing Link Color Based on State

CSS also allows you to change the color of links based on their state, i.e., whether they're being hovered over or are active:

a diagram with the words css3 written in it
a diagram with the words css3 written in it

&:hover { color: purple;}\n

&:active { color: orange;}\n

How to Easily Add CSS Code to WordPress - Get a Free code
How to Easily Add CSS Code to WordPress - Get a Free code
Change Background Color in JavaScript | HTML and CSS Tutorial
Change Background Color in JavaScript | HTML and CSS Tutorial
How to Change the Link Color in WordPress 2025
How to Change the Link Color in WordPress 2025
Text selection color
Text selection color
Squarespace CSS: Add a Link Hover Color on your Site — The Busy Bee
Squarespace CSS: Add a Link Hover Color on your Site — The Busy Bee
CSS Links
CSS Links
How to change color of hyperlinks in 3 easy ways
How to change color of hyperlinks in 3 easy ways
Tips & CSS to Style the Links in Your Website Footer
Tips & CSS to Style the Links in Your Website Footer
a laptop computer sitting on top of a desk next to a vase with flowers in it
a laptop computer sitting on top of a desk next to a vase with flowers in it

In this case, hovering over a link will turn it purple, while clicking and holding on it will turn it orange.

Changing the Underline of Links

The 'text-decoration' property can be used to remove the default underline from your links, or replace it with a different style:

&:link { text-decoration: none;}\n

This rule will remove underlines from all links. You can also add a custom underline using the 'text-decoration' property combined with 'underline' or 'overline':

&:link { text-decoration: underline purple 5px dotted;}\n

This code will give your links a purple underline with a dotted pattern and a width of 5 pixels.

Experimenting with different colors and styles can help you create an engaging and user-friendly website. Try out various combinations to find the perfect fit for your project. Happy styling!