Which is the correct way to specify a hover/focus/visited state on a link which has a class?
a:focus.class{}
or
a.class:focus{}
Both seem to work, just wondered which is considered the right way.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Both are correct since the pseudo-class can appear anywhere in there.
From the CSS2 spec:
Personally I prefer the second though, for readability mainly, that and it may change as you go, e.g.
:hover, so I prefer having all the static then dynamic, not a mix…just makes more sense I guess.