CSS :hover Selector

The :hover CSS pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer).

The :disabled CSS pseudo-class represents any disabled element. An element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has an enabled state, in which it can be activated or accept focus

This CSS tutorial explains how to use the CSS selector called :hover with syntax and examples.

The CSS :hover selector allows you to target an element that the user hovers over with a cursor or mouse pointer.

Syntax

element:hover { style_properties }

The :hover selector is used to select elements when you mouse over them.

The :hover pseudo-class selector specifies elements when a mouse cursor (or other pointing device) hovers over the element. In the following example, the color property will be set to red for any

element that currently has a mouse cursor hovering over it.

Example -