pmdesign Posted February 15, 2006 Share Posted February 15, 2006 Hi,All you know what is a pseudo class:<style type="text/css">a:link {color: #FF0000}a:visited {color: #00FF00}a:hover {color: #FF00FF}a:active {color: #0000FF}</style>But can i use it for my own class like this:<style type="text/css">.myclass{bgcolor: #FF0000}.myclass:link {color: #FF0000}.myclass:visited {color: #00FF00}.myclass:hover {color: #FF00FF}.myclass:active {color: #0000FF}</style>or if it's not right is there any possibility to use a pseudo class for non standart classes? Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2006 Share Posted February 15, 2006 It is possible only if the class refers to a link. Or should I say "if you are aiming for maximum compatability". Firefox and Opera understand :hover (and other pseudo classes on that matter) everwhere in a document. IE6 however only understands it when it's on a link. Otherwise, it doesn't do anything about it. Link to comment Share on other sites More sharing options...
pmdesign Posted February 15, 2006 Author Share Posted February 15, 2006 boen_robot does it mean that if i define class .myclass:link it will affect all links in .myclass? I just wanna know the right syntax Link to comment Share on other sites More sharing options...
aspnetguy Posted February 15, 2006 Share Posted February 15, 2006 boen_robot does it mean that if i define class .myclass:link it will affect all links in .myclass? I just wanna know the right syntax <{POST_SNAPBACK}> I think you would have ot declare it like this.myClass a:link{} Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2006 Share Posted February 15, 2006 It is possible only if the class refers to a link. Or should I say "if you are aiming for maximum compatability". Firefox and Opera understand :hover (and other pseudo classes on that matter) everwhere in a document. IE6 however only understands it when it's on a link. Otherwise, it doesn't do anything about it. Yes. .myclass:link and a.myclass:link are both valid and are both working properly in all browsers. I'm not sure for :link though. I would reccomend that you don't use it. Typing only a.myclass or .mylass Works the same way and I'm completely sure there aren't problems with it.What aspnetguy is suggesting means a link(<a>) inside any element with a class .myclass. It's not euivalent to the ones above, but it's still a good trick to know. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 15, 2006 Share Posted February 15, 2006 Yes. .myclass:link and a.myclass:link are both valid and are both working properly in all browsers. I'm not sure for :link though. I would reccomend that you don't use it. Typing only a.myclass or .mylass Works the same way and I'm completely sure there aren't problems with it.What aspnetguy is suggesting means a link(<a>) inside any element with a class .myclass. It's not euivalent to the ones above, but it's still a good trick to know. <{POST_SNAPBACK}> good to know thanks Link to comment Share on other sites More sharing options...
pmdesign Posted February 15, 2006 Author Share Posted February 15, 2006 Now friends comes the other problem.If .t2 a:link{ color: white;}works fine, what's the right syntax for alink and vlink ?I've tried .t2 a:alink.t2 a:vlinkbut it seems to be not working Link to comment Share on other sites More sharing options...
aspnetguy Posted February 15, 2006 Share Posted February 15, 2006 Now friends comes the other problem.If .t2 a:link{ color: white;}works fine, what's the right syntax for alink and vlink ?I've tried .t2 a:alink.t2 a:vlinkbut it seems to be not working <{POST_SNAPBACK}> a:alink is a:link and a:vlink should be a:visited Link to comment Share on other sites More sharing options...
pmdesign Posted February 15, 2006 Author Share Posted February 15, 2006 a:alink is a:link and a:vlink should be a:visited<{POST_SNAPBACK}> OK i fixed it. But I also have "a" class defined for the other links that are outside .myclassAnd it seems the "a" class cover ".myclass a:link"I dont know what i'm doing wrong but i'll keep trying.Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now