Example
This rule will apply a border to any
img element over which the cursor is
hovered:
img:hover {
border: 5px solid #F2F2F2;
}
Description
The
:hover pseudo-class matches any element that’s
being designated by a pointing device. The term
designated refers to the process during which the
cursor is hovered over the box generated by the
element.
Compatibility
| IE | 5.5 | Buggy |
|---|---|---|
| 6.0 | Buggy | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
In Internet Explorer versions up to and including 6:
:hoveris applied only to HTMLaelements that have anhrefattribute.:hoveris counted as two classes/pseudo-classes in the specificity calculation.:hoveris ignored if it’s not in the last simple selector.
Neither Internet Explorer 5.5 nor 6 supports the chaining of pseudo-classes; only the last pseudo-class is honored in these browsers.
In Internet Explorer 7:
- The element sometimes remains in the hover state if the cursor is moved from the element while the mouse button is pressed; the hover state sometimes doesn’t apply when it should.
:hoverdoesn’t match elements with negativez-indexproperty values.
User-contributed notes
- ID:
- #2
- Date:
- Thu, 07 Feb 2008 06:32:23 GMT
- Status:
- This note has not yet been confirmed for accuracy and relevance.
col:hover and colgroup:hover not supported
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

