Site logo

Archived topic

Different colors for external links and internal links

5 replies · Started by Bernhard on January 26, 2021

Viewing posts 1–6 of 6

Hello,
I would like to use different colors for external links and internal links.

My idea is to use the colors set in the customizer for internal links and assign via CSS to all links, that don't point to my-website.com, another color (probably the standard blue of the Google links).

Hi there,

you can try this CSS:

a:not([href*="your-domain"]) {
  color: blue;
}

This will apply a color to any link that does not contain the your-domain string. So if your site was: www.example-site.com you would use:

[href*="example-site"]

Hi David,
now found a problem with relative links, e.g. in the Table of content, is it possible to address them?
Thank you.

Depends where those links are - for example you could try this:

p a:not([href*="your-domain"]) {
  color: blue;
}

This will only target a link that is within a paragraph.

Perfect, thank you :)

You're welcome

This archived topic is closed to new replies.