CSS/Selectors/pseudo-classes/:hover

From W3C Wiki
< CSS‎ | Selectors
Jump to: navigation, search

Pseudo-classes :hover

The :hover pseudo-class applies while the user designates an element with a pointing device, but does not necessarily activate it.

Syntax

selector:hover{ properties }


Point, Note

  • There may be document language or implementation specific limits on which elements can become :active or acquire :focus.


Example

[style.css]

 a:link, a:visited{
   color: red;
 }
 a:hover{
   color: green;
 }


[index.html]

<body>
  <p><a href="http://www.w3.org/">W3C</a> is an international community</p>
</body>

Css3 selectors dyn hover.png

CSS defines the :hover pseudo-class in 6.6.1.2. The user action pseudo-classes :hover, :active, and :focus.