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

:activeCSS擬似クラスで、ユーザーによってアクティブ化されている要素 (ボタンなど) を表します。マウスを使用する場合は、「アクティブ化」とはふつう、主ボタンを押し下げたときに始まります。

試してみましょう

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

:active 擬似クラスは、よく および

構文

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

アクティブなリンク

HTML

html

CSS

css

結果

フォーム要素をアクティブ化

HTML

html

CSS

css
form :active {
  color: red;
}

form button {
  background: white;
}

結果

仕様書

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

ブラウザーの互換性

関連情報