BACK TO TOP

How to Easily Change the Link Color in WordPress

How to Easily Change the Link Color in WordPress

WordPress comes with a lot of flexibility out of the box, but changing link colors is not there by default. Some themes may have the option to change link color using the WordPress theme customizer (or elsewhere), but that is not always the case. In this tutorial, we will show you how to easily change the link color in WordPress – especially easy if you are using the default Twenty Twenty-One theme.

What we would also like to do, though, is discuss some reasons why you might want to change your link color, and some reasons why you‘d want to refrain from it. Here‘s what we‘ll be talking about:

Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

Changing Link Color Pros And Cons

We‘ll go out on a limb and say that, if you are reading this article, you are looking for a way to change the color of links on your WordPress website. It can be done, it‘s easy enough, but we‘d like to talk about some of the reasons why you should or shouldn‘t do it.

On the pro side of things, we have aesthetics – perhaps your theme‘s default link color doesn‘t agree with your overall design, and you want to make it fit better. Perhaps you want to make the links stand out more or blend in better.

On the con side of things, we have the force of habit. Some design features have been around for a very long time, and people have come to expect certain things: for instance, that a link is blue and underlined, though it doesn‘t have to be.

As far as improving accessibility is concerned, it should be immediately clear what is and what isn‘t a link, and any text should stand out from the background for better legibility. Changing the color of your links can, therefore, both hamper and improve the accessibility of your website.

If you are sure you want to change the link color on your website, keep on reading: we will show you how to do it using CSS, or, if you are using WordPress‘s default Twenty Twenty-One theme, with the aid of a plugin.

How to Change Link Color Using Code

We have started by creating a post and populating it with some generic placeholder text and a couple of links. You can see that they are underlined.

Link With Underline

In order to change the color of the link, you need to add some CSS to your website. CSS stands for Cascading Style Sheets, but what it boils down to is bits of code which mainly have to do with the presentation of your website.

To add CSS to your website, navigate to Appearance/Customize from your WordPress dashboard.

Appearance Customize

Select Additional CSS from the customizer‘s left hand-side menu.

Additional CSS

Finally, enter this code into the CSS field, taking care not to disturb any code which might already be there:

a {
color: #XXXXXX;
}

Of course, you need to replace the XXXXXX placeholder with a color hex code of your choice. We have gone with a light yellow here. Click Publish for the CSS to take effect.

Add CSS and Publish

And this is how our links appear now.

Additional CSS Link Color Change

If you prefer using an RGB color command, you can do that, too. Simply replace the color: #XXXXXX bit with color: rgb(X,X,X). Each of the X‘s in this code can be expressed numerically as an integer value in the range of 0 to 255 or as percentages from 0% to 100%.

How to Change Hover and Visited Link Color Using Code

Using the a element only affects the default state of the links. But suppose you want to change the color of your links in the hover or visited state. In that case, you need to modify your CSS code.

In order to change the on-hover color of the link, use this code:

a:hover {
color: #XXXXXX;
}

For the visited link color, use this:

a:visited {
color: #XXXXXX;
}

You can use none, any, and all of the above pieces of code. In our case, the default state is in yellow, the hover in blue, and the visited in red.

Link Colors

Remember that you can use the color:rgb code as described above for any CSS you want.

How to Change Link Color Using the Twenty Twenty-One Theme and a Plugin

If you are using WordPress‘ default Twenty Twenty-One theme, you can use a plugin called Options for Twenty Twenty-One to add more options, such as changing the link color, to your theme. After having installed the plugin, navigate to the Appearance/Customizer and select Colors & Dark Mode.

Colors and Dark Mode

There you now have the option to change Primary Link Color. You can enter a hex code or select a preferred color for the picker.

Colors and Dark Mode Primary Link Color

If you want to change the link color in the on-hover and visited states of the link, though, you will need to do it using CSS as described in the section immediately above.

In Conclusion

As you have seen, changing the link color is no big deal: you can do it in seconds, simply by pasting a tiny bit of code which we have handily provided for you. Should you do it, though? That‘s up to you. While we encourage you to pursue your aesthetic choices, do bear in mind the expectations most website visitors have of links, and don‘t forget about accessibility.

Post your comment

Comments0