PAGE DE TESTS

Partager l'article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 

Definition and Usage

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

Tip: The :hover selector can be used on all elements, not only on links.

Tip: Use the :link selector to style links to unvisited pages, the :visited selector to style links to visited pages, and the :active selector to style the active link.

Note: :hover MUST come after :link and :visited (if they are present) in the CSS definition, in order to be effective!

Version: CSS1

Browser Support

The numbers in the table specifies the first browser version that fully supports the selector.

Selector
:hover 4.0 7.0 2.0 3.1 9.6

Note: In IE there must be declared a <!DOCTYPE> for the :hover selector to work on other elements than the <a> element.


CSS Syntax

:hover {
    css declarations;
}


More Examples

Example

Select and style a <p>, <h1> and <a> element when you mouse over it:

p:hover, h1:hover, a:hover {
background-color: yellow;
}

Definition and Usage

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

Tip: The :hover selector can be used on all elements, not only on links.

Tip: Use the :link selector to style links to unvisited pages, the :visited selector to style links to visited pages, and the :active selector to style the active link.

Note: :hover MUST come after :link and :visited (if they are present) in the C


Partager l'article
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •