paulonline2501 Posted March 13, 2012 Share Posted March 13, 2012 hi everyone, im having a problem with working out how to stop text that has an anchor (with no hyperlink) from changing color when i hover over it. i've set the ancors for the whole site in my css like so (they're normally hyperlinks, the only reason i noticed this problem when i added some boomarks to pages so i could hyperlink straight to some sections in a long doc): a, a:link, a:active{color: #990000;}a:hover{text-decoration:none; color:#990000;} if i add an achor for the bookmark... <a name="whatever">some text</a> ...then the anchor is treated as a all other anchors.fare enough as thats what i told it do in the css above. however i have tried to override this for my bookmarks that are always h2's like so: h2 a{color: #666666;} h2 a:hover{color: #666666;} however, this override is not working as i would expect. the hover part is being ignored and shows up red as defined in the first declaration. any ideas what i'm missing? you can see the page i'm testing on herehttp://www.paulyouth...d-there-css.php Link to comment Share on other sites More sharing options...
dsonesuk Posted March 13, 2012 Share Posted March 13, 2012 try .content h2 a:hover, .content h2 a:link, .content h2 a:active { color: #666666;} Link to comment Share on other sites More sharing options...
ShadowMage Posted March 13, 2012 Share Posted March 13, 2012 Just so you know, named anchors are deprecated or at the very least, not recommended. You can just give an id to your h2 to get the same effect. http://w3schools.com/html/html_links.asp Link to comment Share on other sites More sharing options...
paulonline2501 Posted March 13, 2012 Author Share Posted March 13, 2012 ...thanks ShadowMage i used your ID method which worked just fine and keeps my coding up-to-date - bonus. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.