Differences between CSS3 :hover and :focus?

Pete Wilson picture Pete Wilson · May 26, 2011 · Viewed 45.7k times · Source

The CSS3 doc talks about :hover and :focus, which seem exactly the same to me. What are the differences between the two? What am I not seeing?

Thanks!

Answer

Marc B picture Marc B · May 26, 2011

Hover is 'true' when the mouse pointer is over an element. Focus is true if the cursor is in that element. It's possible for hover to be false and focus true (e.g click in a text field then move the mouse away)