How to change the link color in a specific class for a div CSS
Solution 1
.register a:link{
color:#FFFFFF;
}
Solution 2
It can be something like this:
a.register:link { color:#FFF; text-decoration:none; font-weight:normal; }
a.register:visited { color: #FFF; text-decoration:none; font-weight:normal; }
a.register:hover { color: #FFF; text-decoration:underline; font-weight:normal; }
a.register:active { color: #FFF; text-decoration:none; font-weight:normal; }
Solution 3
how about something like this ...
a.register:link{
color:#FFFFFF;
}
Solution 4
I think there is a confusion about what the OP is actually asking.
This solution:
a.register:link {color:#FFF}
...changes the color of a link whose class is "register". But that's not what the OP was asking.
And this solution:
.register a:link {color:#FFFFFF;}
...changes the color of a link that itself has no class but is placed inside of a div with class "register". And that's what the OP was asking.
Both of these answers are being upvoted here but only the second one is correct answer to the original question.
Solution 5
#register a:link
{
color:#fffff;
}
Anil Jain
Updated on July 09, 2022Comments
-
Anil Jain almost 2 years
In my Page the following CSS is set:
a:link { color: #0094DE; text-decoration: none; } a:visited { text-decoration: none; color: #0094DE; } a:hover { text-decoration: underline; color: #DD127B; }
I want to Change the Link color inside a div which has a class assigned to it. I tried the following :
register:link{color:#FFFFFF; }
Where register is the name of the div in which i want to change the link color. How can i do that? Also how to change the color for hover link over the same div?
-
carrabino over 10 yearsnote that this should be #register, not .register ... the OP said div not class
-
Nels Beckman over 9 years@Anthony The OP said div with a class assigned to it. Does what you say still apply?
-
carrabino over 9 yearsOP: "Where register is the name of the div in which i want to change the link color" ... which to me says register is the id value, not the name of a class that's been assigned to the div.
-
Ryan S over 8 yearsThis is actually the problem I was trying to solve: this places styling on something like this: <a class="register">click me</a> Thanks!
-
ZeekLTK over 7 yearsThe top voted answer did not work for me, but using this syntax did work. Voting for this one.
-
Magiranu over 6 yearsSame for me too. +1
-
Magiranu over 6 yearsThis answer doesn't work for multiple users. See stackoverflow.com/a/30296997/8314623 for a different solution.
-
JenVander about 6 yearsThis was the only syntax that worked for me as well. Thanks so much!
-
Aditya P Bhatt about 6 years@JenVander thanks for your motivation :) it helps a lot!
-
Adam about 3 yearsThank you for your answer! Make sure you take a look at the other answers in the thread as well before submitting. It looks like this answer is the same as the current top voted but was determined to not be the final working solution.
-
fuxoft about 3 yearsCurrently the most upvoted answer is correct and the second most upvoted answer is wrong but it's getting upvoted and praised anyway because it's correct for people who are trying to solve different problem than the OP posed. That's why I posted this to hopefully clear the confusion.
-
ZioBit over 2 yearsI can confirm I had the same problem with the top voted, this one worked immediately