Using the :active Selector

Description

The :active selector matches elements when the mouse is pressed on them.

Example

The following code shows how to use the :active Selector.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:active {<!--from  w  w w .j  a v a 2  s.c  om-->
  border: thin black solid;
  padding: 4px;
}
</style>
</head>
<body>
  <a href="http://java2s.com">Visit the website</a>
  <p>
    I like <span>HTML</span> and CSS.
  </p>
  <button>Hello</button>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table