The :active
selector matches activating elements.
The :active
selector isn't limited to
elements with which the user can interact.
:active
is a Pseudo-class selector and it applies to
an element that is being activated.
The most common example is clicking on a hyperlink in an HTML document: while the mouse button is being held down, the link is active.
Examples:
a:active {color: red;} *:active {background: blue;}
:active { style properties }
:active |
Yes | 7.0 | Yes | Yes | Yes |
An example showing how to use :active CSS selector.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
:active { <!--from w w w. ja v a 2 s.c o m-->
border: thin black solid;
padding: 4px;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the java2s.com</a>
<p>I like <span>HTML</span> and CSS.</p>
<button>Hello</button>
</body>
</html>