CSS trouble - changing colour of a link in cookie bar - css

I've got a CSS prob i'd love some help with.
My site (www.melodylakerart.com) has a 'Read More' link in its cookie notice bar (to the right of the privacy notice).
The 'read more' link is currently only visible on mouse over. Since the cookie bar is black I therefore assume the link text is black untill mouseover
I just want to make the text a colour other than black so you can see the link without having to mouseover. I've tried the below CSS with no luck. Can anyone help?
.cn-more-info .cn-privacy-policy-link .cn-link .button {color: #feb8b4 !important;}
.cn-privacy-policy-link {color: #feb8b4;}
.cn-more-info .cn-privacy-policy-link .cn-link .button {color: #feb8b4;}

Link color can be changed via a:link or under a specific class
.cn-privacy-policy-link a:link
for example:
a:link {
color: red;
text-decoration: none;
}
a:visited {
color: green;
}
a:active {
color: black;
}
a:hover{
color: #bada55;
}
.test a:link{
color: yellow;
}
Example
<div class="test">Yellow link</div>
You can also change the link color on hover by a:hover or the link color after being clicked by a:visited or while being clicked with a:active

The problem is that you have this:
input[type="submit"], button, .button {... color: #000000!important; ...}
And that is the classic reason why !important is a bad practice.
If all other parts work as expected, you need to trigger one of the element's classes. For instance: cn-privacy-policy-link {color: #feb8b4!important;} will work.

Related

How to disable text decoration with CSS?

So, I need to remove a visited link coloring from my navigation bar, as it will look ugly.
I have tried to use text-decoration: none; and color: white; but that does not seem to help it.
CSS for navigation
Actual code
I removed the actual links from the code, in the real version there is link but for this question links are replaced with #
In addition to Bariock's answer, this will help reset your <a> links in all circumstances to your specified css.
a:visited, a:hover, a:active, a:focus {
color: yourColor !important;
text-decoration: none !important;
outline: none !important;
}
The !important signifies that it has a higher precedence than that of other rules declaring the same values for the same selectors. Note: you can still style them separately such like you would with :hover.
a:visited{
color: your-color;
}
I edited the <a> tag to go around the <button> so the text is back to white now and the button actually works. It is no longer just "click text to visit link" the whole button works.
<button class="dropbtn">Community</button>
Try adding a !important to the end of the css styles like so:
a {
color: white !important;
}
Hope this helps!
I recommend you first set the style of the link tag, for example:
.dropdown a{ color:#fff }
now your text links inside the container with the class .dropdown will be as white color. Then you don't need to set a visited link color, unless you want to set it.
If you want to get rid the underline in the link, your style will be like this:
.dropdown a{ color:#fff; text-decoration: none; }

why the color of the :link don't show?

I set the a's style to be red, but color of :link doesn't work, why?
I don't click the link, the color of it should be red, but it shows green for me.
a:link{
color: red;
}
a:visited{
color: green;
}
a:hover{
color: blue;
}
a:active{
color: yellow;
}
test
My result:
As suggested, you might want to read up on the rules/ guides before asking a question (been there).
However, to answer your question you do not need to use the :link when styling an a tag, just simply style is as such:
a {
color: red;
}
Here is a working example of what you're after; https://codepen.io/MartynMc/pen/KqYrWY

a:active isn't working, is there another code?

Not sure if this is the css I am looking for. I want the active link to have a hover color. By active link I mean my aside link that I am currently visiting.
.widget-area .widget a {
color: #bc7ed1;
}
.widget-area .widget a:hover {
color: #D6A0DB;
}
.widget-area .widget a:visited {
color: #ccc2d3;
}
.widget-area .widget a:visited:hover {
color: #;
}
.widget-area .widget a:active {
color: #;
}
a:active isn't making a color change - is there a different word for the page I am currently visiting or active on? Perhaps something like a:visited:active? Just want the page I am on, that link to be a new color.
I think you misunderstood the pseudo class :active
:active is used for when a user clicks on the link and holds it. And :visited is when a url is already visited. w3schools link on :active
If you need a special style for link of current page add a class like .currentpage to the a-tag with the url via backend or via javascript with style as
.currentpage {color:#ff0000;} /* or any color you prefer */
Hope this helps.

Modifying links design for a tumblr theme

I'm trying to modify the way links display in the theme I'm currently working on with the a:link a:hover method in a css file but it don't work and I can't understand why... Any help ? Thank you
You can try this (note a:link doesn't exist in CSS):
a {
text-decoration:none;
color:#000;
font-style:italic;
}
font
a:hover {
text-decoration:underline;
color:#000;
}
a:visited {
color:#000;
}
"a" is the link. text-decoration: none removes the underline, text-decoration: underline adds the underline. font-style:italic adds an italic to the link. the color #000 is black and using that color in a:visited ensures that the link stays black after it's visited (I didn't know if you would want that so I added it anyway).

how do I make HTML links show hover style?

I have some HTML markup in my ASP.NET master page representing a basic navigation menu. THree words that link to three pages. My CSS and HTML are included below for your reference.
When I load the page, the links appear with the correct color (red). If I hover over a link, the link changes to the correct color (blue). So far, we're good. Clicking a link changes the link color to the correct color (yellow). The two remaining links are still red / blue as expected. Clicking a second link changes that link to yellow also. Now I have two yellow links. Neither yellow link displays the hover color (blue) like I'd prefer. Clicking the third link causes it to be yellow, too and none of the links display the hover style.
Although a link has been clicked, I'd like the color to be stored and have the hover color displayed. How do I accomplish this? This is an ASP.NET web application project but I'm only using straight HTML at this point.
/* --- css --- */
a:link
{
color: red;
text-decoration: none;
}
a:hover
{
color: blue;
text-decoration: none;
}
a:active
{
color: green;
text-decoration: none;
}
a:visited
{
color: yellow;
text-decoration: none;
}
/* --- HTML --- */
<p class="MenuItems">
Cars.
Trucks.
Vans.
</p>
As described here, the :hover declaration must come AFTER the :visited and :active declarations.
Basically, in the cascade of your current styles, you won't ever see the :hover color.
Your
a:hover
declaration must come after your
a:visited
declaration in the stylesheet because the visited state is currently taking priority. Always put hover at the end of the a styles declaration block to prevent this.
a:link -> a:visited -> a:active -> a:hover is the optimal ordering.
Just use this:
a:hover
{
color: blue ! important;
text-decoration: none ! important;
}
or as described - use this order:
a:link
{
color: red;
text-decoration: none;
}
a:active
{
color: green;
text-decoration: none;
}
a:visited
{
color: yellow;
text-decoration: none;
}
a:hover
{
color: blue;
text-decoration: none;
}

Resources