Search w3schools.com:

SHARE THIS PAGE

CSS Reference

CSS Reference CSS Selectors CSS Reference Aural CSS Web Safe Fonts CSS Units CSS Colors CSS Color Values CSS Color Names CSS Color HEX CSS3 Browser Support

CSS Properties

CSS :active Selector

Complete CSS Selector Reference Complete CSS Selector Reference

Example

Select and style the active link:

a:active
{
background-color:yellow;
}

Try it yourself »

Definition and Usage

The :active selector is used to select and style the active link.

A link becomes active when you click on it.

Tip: Use the :link selector to style links to unvisited pages, the :visited selector to style links to visited pages, and the :hover selector to style links when you mouse over them.

Note: :active MUST come after :hover (if present) in the CSS definition in order to be effective!


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The :active selector is supported in all major browsers.


Related Pages

CSS tutorial: CSS Links

CSS tutorial: CSS Pseudo classes


Examples

Try it Yourself - Examples


Example

Select and style unvisited, visited, hover, and active links:

a:link    {color:green;}
a:visited {color:green;}
a:hover   {color:red;}
a:active  {color:yellow;}

Try it yourself »

Example

Style links with different styles:

a.ex1:hover,a.ex1:active {color:red;}
a.ex2:hover,a.ex2:active {font-size:150%;}

Try it yourself »


Complete CSS Selector Reference Complete CSS Selector Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]