Adjusting the colour of links within just posts

  • Anonymous

    #3290

    Hello all,

    How do I change the colour of URLs within the posts alone? I wish to keep my permalink and the links within my widgets black, but I want the SEO-friendly outbound links (and links to other articles) within the articles to be blue.

    Any help would be appreciated!

    Mod

    Kenneth John Odle

    #24264

    Use this code in your child theme style sheet or custom css:

    .entry-content a {style elements}
    .entry-content a:visited {style elements}

    Anonymous

    #24265

    Done. Thanks Kenneth!

    Anonymous

    #24266

    Hmm… I notice that the colours of the links in the A-Z index have also changed, which is unsurprising but not desirable. Is it possible to exclude a page from this change?

    Mod

    Kenneth John Odle

    #24267

    Do you mean this page: http://www.yourfinancialaidoffice.com/articles-list/

    In that case, the class of that page is .page-id-4

    So you can use the not pseudo class, like this:

    .entry-content a, .entry-content a:not(.page-id-4) {style elements}
    .entry-content a:visited {style elements}

    Unfortunately, I don’t know that you can combine pseudo classes, so either you’re stuck with your visited link color on that page, or you’ll have to do everything like this:

    .entry-content a {style elements}
    .entry-content a:visited {style elements}
    .page-id-4 .entry-content a {style elements}
    .page-id-4 .entry-content a:visited {style elements}

    The advantage of using the not pseudo class is that everything on that page will just use standard formatting, and you won’t have to redefine the styles for just that page, as you have to with the second method.

    Anonymous

    #24268

    Thanks Kenneth. Using the second option, my inner page links are now blue whilst the A-Z page links are black, as desired. I don’t know what you mean about redefining the styles, but option #2 seems to work without inconsistencies.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!