NoSalt Posted November 14, 2012 Share Posted November 14, 2012 Hello All Could I get a little help with this CSS? In my stylesheet I have my anchor colors defined: a:link {} a:visited {} a:hover {} Later on in the stylesheet, I have some anchors that are within a span defined: span.logout {} span.logout a:link, a:visited {} span.logout a:hover {} The only thing is, my anchor colors in the logout div are overriding my primary anchor colors. I am confused as to why this is happening. I thought only the anchors within the "logout" span would be affected by this CSS. Anyway, if anybody could help out with this, I would appreciate it. Also, am I using the term "CSS subclass" correctly? Thanks for taking the time to read, and have a great day. Quote Link to comment https://forums.phpfreaks.com/topic/270656-problem-getting-css-subclass-to-work-help-needed/ Share on other sites More sharing options...
codefossa Posted November 14, 2012 Share Posted November 14, 2012 If you're making :link and :visited the same color, there would be no reason to do both. Also, you used a comma so you would need span.logout a:visited there, which could be your problem. Maybe try using ! important if that's not it. Quote Link to comment https://forums.phpfreaks.com/topic/270656-problem-getting-css-subclass-to-work-help-needed/#findComment-1392177 Share on other sites More sharing options...
cutielou22 Posted November 14, 2012 Share Posted November 14, 2012 Also make sure the coding is right - it should look something like this: <span class="logout"><a href="link">Whatever</a></span> Quote Link to comment https://forums.phpfreaks.com/topic/270656-problem-getting-css-subclass-to-work-help-needed/#findComment-1392183 Share on other sites More sharing options...
NoSalt Posted November 14, 2012 Author Share Posted November 14, 2012 Xaotique ... I'm not sure what you mean by "span.logout a:visited there" cutielou222 ... Yes, the html is correct, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/270656-problem-getting-css-subclass-to-work-help-needed/#findComment-1392255 Share on other sites More sharing options...
Scott_S Posted November 14, 2012 Share Posted November 14, 2012 Xaotique is saying change span.logout a:link, a:visited {} to span.logout a:link, span.logout a:visited {} Quote Link to comment https://forums.phpfreaks.com/topic/270656-problem-getting-css-subclass-to-work-help-needed/#findComment-1392377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.