[Resolved] My CSS styled some links I didn’t want to change

Home Forums Support My CSS styled some links I didn’t want to change

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1385234
    Randy

    Hi. I’m new to GeneratePress, and I’m more of a tinkerer than a web-designer. 🙂

    I used CSS to style the links in my posts (below), which seems to work, but it also effects the links for the Related posts after my post. For example, see this blog post.

    Is there an easy fix, to not change the style of the links in Related posts?

    /* unvisited link */
    .entry-content a:link {
      color: #283655;
    	font-weight: 600;
    	background-color: #d0e1f9;
    }
    
    /* visited link */
    .entry-content a:visited {
      color: #d0e1f9;
    }
    
    /* mouse over link */
    .entry-content a:hover {
      background-color: #4d648d;
    	color: #fff;
    }
    
    /* selected link */
    .entry-content a:active {
      color: #d0e1f9;
    }
    #1385391
    David
    Staff
    Customer Support

    Hi there,

    the related post links are output within a span tag.
    Whereas your post content generally puts them within a paragraph.

    You can target anchors specifically within paragraphs with this direct descendent selector p > a

    So this:

    .entry-content a:link

    would become:

    .entry-content p > a:link

    #1385670
    Randy

    Awesome, thanks!

    #1385684
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.