CSS :hover pseudo-class
Complete CSS Reference
Example
Specify the color of links:
a:link {color:#FF0000} /* unvisited link */
a:visited {color:#00FF00} /* visited link */
a:hover {color:#FF00FF} /* mouse over link */
a:active {color:#0000FF} /* selected link */ |
Try it yourself »
More examples at the bottom of this page.
|
Definition and Usage
The :hover pseudo-class adds a special style to an element when you mouse over it.
Active, visited, unvisited, or when you mouse over a link, can
all be displayed in different ways.
Note: a:hover MUST come after a:link and a:visited in the CSS
definition in order to be effective!
Note: a:active MUST come after a:hover in the CSS definition in order
to be effective!
Pseudo-classes can be also be combined with CSS classes, like
this:
a.red:visited {color:#FF0000}
<a class="red" href="css_syntax.asp">CSS Syntax</a> |
If the link in the example above has been visited, it will be displayed in red.
Browser Support

The :hover pseudo-class is supported in all major browsers.
 |
Try it Yourself - Examples |
Hyperlink 2
This example demonstrates how to add other styles to hyperlinks.
Related Pages
CSS tutorial: CSS Pseudo classes
Complete CSS Reference
Create a free Flash website with our simple, online web design editing platform. Stunning templates
and user-friendly tools make website building easy and fun.
Start Creating your free website now!

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file,
Excel 2007, XBRL, or Web services data. Then it transforms data instantly or
auto-generates royalty-free code for recurrent conversions.
New features in Version 2010!
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
- Available in 32-bit and 64-bit versions
Download a fully-functional trial today!
|
|
|
|