: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.

Die :active CSS Pseudoklasse repräsentiert ein Element (wie einen Button), das vom Benutzer aktiviert wird. Bei der Verwendung einer Maus beginnt die "Aktivierung" in der Regel, wenn der Benutzer die primäre Maustaste drückt.

Probieren Sie es aus

.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?

Die :active Pseudoklasse wird häufig auf - und

Syntax

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

Beispiele

HTML

html

CSS

css

Ergebnis

Aktive Formularelemente

HTML

html

CSS

css
form :active {
  color: red;
}

form button {
  background: white;
}

Ergebnis

Spezifikationen

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

Browser-Kompatibilität

Siehe auch