very strange thing.
I want to change the color of the text and the background color of the links on hover.
this is code
CSS
#link-menu a { color:white; display:block; height:100%; width: 100%; text-decoration:none; text-align:center; line-height:45px; font-weight:bold; font-family:"trebuchet ms","comic sans ms"; outline:none; } .link2 a:hover { color:black; background:white; }
doesn’t mean the guidance is not working. the background color changes, but the text color does not change.
Another important fact is that if I use id instead of using the .link2 class, the color also changes. The problem is only using the class. Can someone explain the reason and solution?
Note. I do not want to use the parent id. because I don’t want to change the background of all links.
source share