:current
Селектор псевдокласса :current CSS псевдокласса является псевдоклассом, зависящим от времени, который представляет элемент или предка элемента, который в данный момент отображается. Например, этот псевдокласс можно использовать для представления видео, которое отображается с субтитрами с помощью WebVTT.
:current(p, span) {
background-color: yellow;
}
Синтаксис
:current {
/* ... */
}
:current(<compound-selector-list>) {
/* ... */
}
Примеры
CSS
:current(p, span) {
background-color: yellow;
}
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
Спецификации
| Спецификация |
|---|
| Selectors Level 4 # the-current-pseudo |
Совместимость с браузерами
См. также
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/:current