:active

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The :active CSS pseudo-class represents an element (such as a button) that is being activated by the user. When using a mouse, "activation" typically starts when the user presses down the primary mouse button.

Try it

.joinBtn {
  width: 10em;
  height: 5ex;
  background-image: linear-gradient(135deg, #f34079 40%, #fc894d);
  border: none;
  border-radius: 5px;
  font-weight: bold;
  color: white;
  cursor: pointer;
}

.joinBtn:active {
  box-shadow: 2px 2px 5px #fc894d;
}

Would you like to subscribe to our channel?

The :active pseudo-class is commonly used on and

Syntax

css
:active {
  /* ... */
}

Examples

HTML

html

CSS

css

Result

Active form elements

HTML

html

CSS

css
form :active {
  color: red;
}

form button {
  background: white;
}

Result

Specifications

Specification
HTML
# selector-active
Selectors Level 4
# active-pseudo

Browser compatibility

See also