:current

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

:currentCSS擬似クラスセレクターで、現在表示されている要素またはその要素の祖先を表す、時間軸の擬似クラスです。例えば、この擬似クラスを使用すると、 WebVTT によってキャプション付きで表示されている映像を表すことができます。

css
:current(p, span) {
  background-color: yellow;
}

構文

css
:current {
  /* ... */
}

:current(<compound-selector-list>) {
  /* ... */
}

CSS

css
:current(p, span) {
  background-color: yellow;
}

HTML

html
<video controls preload="metadata">
  <source src="video.mp4" type="video/mp4" />
  <source src="video.webm" type="video/webm" />
  <track
    label="English"
    kind="subtitles"
    srclang="en"
    src="subtitles.vtt"
    default />
</video>

WebVTT

WEBVTT FILE

1
00:00:03.500 --> 00:00:05.000
This is the first caption

2
00:00:06.000 --> 00:00:09.000
This is the second caption

3
00:00:11.000 --> 00:00:19.000
This is the third caption

仕様書

Specification
Selectors Level 4
# the-current-pseudo

ブラウザーの互換性

この機能を実装しているブラウザーはありません。

関連情報