:hover Pseudo-class

Internet Development Index

Sets the style of an a element when the user hovers the mouse pointer over the link.

Syntax

HTML [A]:hover { sRules }
ScriptingN/A

Possible Values

sRulesString that specifies one or more Cascading Style Sheets (CSS) attribute/value pairs.

Remarks

The default value of the :hover pseudo-class is browser-specific.

Hover means that the user has positioned the mouse pointer over the link but hasn't clicked or otherwise activated the element. If the user simply passes the mouse pointer over the link, the style does not change.

The :hover pseudo-class is often used with :active, :link and :visited, the pseudo-classes that affect the other states of a link.

Example

The following style rule sets the style of an anchor. When the user hovers the mouse pointer over a link to which the following style sheet has been applied, the text displays in red, converts to uppercase, and the characters are spaced 1 centimeter apart.

<STYLE>
A:hover { color:red; text-transform:uppercase; letter-spacing:1cm }
</STYLE>

Standards Information

This pseudo-class is defined in CSS, Level 2 (CSS2) Non-Microsoft link.

Applies To

A