Differences between CSS3 :hover and :focus?

CssFocusHoverCss SelectorsPseudo Class

Css Problem Overview


The http://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act"> 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!

Css Solutions


Solution 1 - Css

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)

Solution 2 - Css

:hover applies to any element that the mouse cursor is currently over. :focus refers to form focus, and is the current form element with focus. Roughly speaking, if you start typing, which element will you be filling?

Solution 3 - Css

The different between :hover and :focus is:

:hover when your mouse pointer is on the element.

:focus when you select an element, the element gets into the focus.

More Information: CSS Pseudo Classes at W3Schools

Solution 4 - Css

hover only applies when the pointing device is over the element. The doc makes that quite clear.

Solution 5 - Css

Hover you can add with % percentages with transition timing with the new css3 technology. Expect IE9 all major browsers will support them. here are some samples of two navigation menus to understand hover and animation on hover and also the fading of the colors in css3 hover attribute. `

Solution 6 - Css

Hover is particularly about Mouse Pointer:

Example when Mouser pointer is over / (on the) Button, for that button hover is true.

Focus is about the highlighting element:

Usually when we use tab key to change the focus of an element.

Solution 7 - Css

There is a "contrasting difference" between the two:

Hover-When your mouse pointer hover(wave or float) over a particular element.

and

Focus-When you select an element,then the element gets into focus.

Solution 8 - Css

The main difference between these two things i.e. hover and the focus is:

hover:- when you take your mouse pointer is on the particular element such as button, text-field etc.

focus:- when you select an element or click an event that time it changes its original state and looks different.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPete WilsonView Question on Stackoverflow
Solution 1 - CssMarc BView Answer on Stackoverflow
Solution 2 - CssrecursiveView Answer on Stackoverflow
Solution 3 - CssVishal NagdaView Answer on Stackoverflow
Solution 4 - CssspenderView Answer on Stackoverflow
Solution 5 - CsschumegoView Answer on Stackoverflow
Solution 6 - Csssiluveru kiran kumarView Answer on Stackoverflow
Solution 7 - CssShridhar ChoukseyView Answer on Stackoverflow
Solution 8 - CssAkash AgrawalView Answer on Stackoverflow