Site logo

Archived topic

Forcing color for hyperlinks

5 replies · Started by Rik on August 3, 2021

Viewing posts 1–6 of 6

Dear GP,
your theme is sometimes quite 'strong' in enforcing certain CSS styles. E.g. for hyperlinks, it seems impossible to override the colors that are set in the GP settings.
For example, see:
https://wordpress-629792-2052721.cloudwaysapps.com/test/
Here we put the following element:
<p class="has-text-align-center">test hyperlink text</p>
But, we want to make this hyperlinked text a different color. So we tried:
<p class="has-text-align-center" style="color:#5CC4E8">test hyperlink text</p>
This did not work. Then we tried:
<p class="has-text-align-center" style="color:#5CC4E8 !important">test hyperlink text</p>
This did not work either.
Is there any way to override the general GeneratePress style settings for this specific element? (we have had similar problems in other parts of the theme, e.g. menu items, when we tried overriding with custom CSS classes, but it did not work)
thanks for the help,
Rik

Hi there,

the problem you have is you're adding the color to the <p> when it needs to be added to the <a>
So if you're using inline styles it would be like so:

<a href="the_url" style="color: #5CC4E8">Test hyperlink text</a>

Or the alternative method is to use CSS Classes, on the P element eg. Give the Text block an Additional CSS Class eg: link-blue

Then add a CSS rule of:

p.link-blue a {
    color: #5CC4E8;
}

Hi David,
brilliant, the "a" addition did the trick. It's solving it for our hyperlinks, but i'm still having trouble with our buttons. See:
https://wordpress-629792-2052721.cloudwaysapps.com/charities/
i've given the buttons a special CSS class called "facetwpbutton".
I'd now like to get these buttons centered like the rest of the content, but i cannot seem to make it happen. What CSS should I use for that?

Should be this:

.facetwpbutton {
    text-align: center;
}

great David, thanks for the good and quick help every time.
Rik

You're welcome

This archived topic is closed to new replies.