DevOpsSauce
DevOpsSauce

Reputation: 1387

Link style not setting for all links in CSS

I'm slowly learning html/css. I have a client that wants 3 links on the page to be noticeable link colors (in this case, blue). However, when I try to edit the style of the links, only two of them are showing the changes.

URL Links

I can't set it globally, or other links (such as some social media icons) are changing.

Here is what I've tried:

div.entry-content a:link {
color: blue;
}

entry-content a:link {
color: blue;
}

Here is what I'm looking at when I inspect the page:

Inspect Element

So, where am I going wrong? I hope I added everything needed for assistance. Thanks.

Upvotes: 1

Views: 315

Answers (3)

Vunb
Vunb

Reputation: 37

It seems you have clicked on the link earlier, so the link status is active or visited.

Try this, if ok then update your code with pseudo selectors :active and :visited:

a, a:link, a:visited, a:active {
    color: blue;
}

Hope this help!

Upvotes: 1

jerrylow
jerrylow

Reputation: 2629

I'm assuming all three links are wrapped in in div with class entry-content. The only thing I can think of is that the first link is black or darker color because it's active or visited. You can style your links with just a selector or with additional pseudo selectors.

/* Just a selector */
.entry-content a {
    color: blue;
}

/* Just a selector */
.entry-content a,
.entry-content a:visited,
.entry-content a:active {
    color: blue;
}

Upvotes: 3

shorepound
shorepound

Reputation: 48

Try adding a class name to the anchors, like so: <a class="blue" href="url">link text</a> and then in your css create the blue class .blue { color: blue; }

Upvotes: -1

Related Questions