WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change link colour (10 posts)

  1. tooly228
    Member
    Posted 3 years ago #

    If you visit my site cpcheatscp.com, you'll see that my under my css for the link, the code is as follows:

    a:link, a:active {
    border:medium none;
    color:#3664B2;
    text-decoration:none;
    }

    However, I want my categories and tags which can be found just below the post title to be a different colour meanwhile they are under the code above. How do I change the colour of the categories links but not change the colour of the other links in the post content?

  2. govpatel
    Member
    Posted 3 years ago #

    Change #3664B2 to color you want that does not change links in post. how ever it changes links in side bar.

  3. tooly228
    Member
    Posted 3 years ago #

    No, it does change the link colour in the post and the sidebar. I just want the categories links to be a different colour.

  4. gixxer188
    Member
    Posted 3 years ago #

    These are the only "link" styles within your CSS.

    a:link,a:active{text-decoration:none;color:#3664B2;border:none;}
    a:visited{text-decoration:none;color:#069;border:none;}
    a:hover{text-decoration:underline;color:#69c;border:none;}

    You would need to define a new class within your CSS and assign it specifically to the "entry2" class and then change the color on it.

    Example:

    #entry2 a:link,a:active{text-decoration:none;color:#3664B2;border:none;}
    entry2 a:visited{text-decoration:none;color:#069;border:none;}
    entry2 a:hover{text-decoration:underline;color:#69c;border:none;}
  5. gixxer188
    Member
    Posted 3 years ago #

    Sorry, should have been this........

    #entry2 a:link,a:active{text-decoration:none;color:#3664B2;border:none;}
    #entry2 a:visited{text-decoration:none;color:#069;border:none;}
    #entry2 a:hover{text-decoration:underline;color:#69c;border:none;}
  6. tooly228
    Member
    Posted 3 years ago #

    OK I've added them to my CSS stylesheet but how do I assign the categories to that specific class when it's in PHP. This is what I have in index.php:

    <div class="entry2">Categories: <?php the_category(', ') ?>...

    See the categories is under that div class but how do I make the links in the categories under the #entry2 a: class?

    Thanks.

  7. gixxer188
    Member
    Posted 3 years ago #

    Sorry, try .entry2 not #entry2. This would then match your entry2 class that you already have and tie in the A link attributes.

  8. gixxer188
    Member
    Posted 3 years ago #

    Something is very screwy with your code.

    </div class="entry"><div class="entry2">Categories:

    There should never be a class="" in a closing DIV tag.

  9. gixxer188
    Member
    Posted 3 years ago #

    What template are the category tags links coming from? You will need to go to that template and add class="entry2" to the a href tag.

  10. tooly228
    Member
    Posted 3 years ago #

    This worked!

    try .entry2 not #entry2

    I thank you so much for your help on this. And the reason why I put class="" in the closing div tag because I wanted that class to end and not the other class that it is under.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags