Site logo

Archived topic

Change link color custum CSS

5 replies · Started by James on April 3, 2019

Viewing posts 1–6 of 6

Trying to change the color of a specific link.

I've added the following CSS

a.red-link {
color: #ee4938;
}

Then on the page I'm editing I've added red-link to the additional CSS class, which gives me the following

<h4 class="red-link">Example Text</h4>

Not having any luck.

Hi there,

when using a.red-link as your CSS selector the class has to be added to the <a> tag.
So you're HTML would look like this:

<h4><a class="red-link" href="url">My red link</a></h4>

Thanks David. I guess Wordpress blocks doesn't format the code correctly if you add a CSS class then switch the block to HTML edit.

One more question - I have the primary menu Nav text current colour set to red. This works for each menu link except the home page, titled BLOG. Any ideas why this is?

That usually happens when WordPress isn't aware of the relationship between the menu and the page.

Try clicking "View All" in "Appearance > Menus" when looking at the pages box, and choose the "Home" menu item at the top.

Then you can change the label to "Blog", and WordPress should be more aware.

Let me know :)

Strange, I had done that when first setting up the primary menu - for some reason it stopped working. Removing, then adding back and renaming the home page worked.

Love the support on this site - thanks for all the help.

No problem! :)

This archived topic is closed to new replies.