Site logo

Archived topic

My CSS styled some links I didn't want to change

3 replies · Started by Randy on August 2, 2020

Viewing posts 1–4 of 4

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;
}

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

Awesome, thanks!

You're welcome

This archived topic is closed to new replies.