I was digging some css codes written by someone and I found this:
li.hover, li:hover {
}
Is there any difference between .hover and :hover?
Maybe some browsers act differently for hover?!
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.
:hoveris a psuedo-class while.hoveris a selector for the classhover. These symbols (:and.) don’t change meaning from any other CSS selector construct: see the W3C CSS Level 3 Recommendation for all the details.Presumably there is some JavaScript to toggle the
hoverclass, perhaps because of lack of:hoversupport for LI elements in a “legacy” browser. I know that IE5/6 (ick!) only supported:hoverfor links, however::hover.(And, as always, make sure the page is not in “quirksmode” 🙂
Happy coding.