:current
:current
CSS 伪类 选择器是一个时间维度伪类,它表示当前正在显示的元素或元素的祖先。例如,此伪类可用于表示通过 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
规范
规范 |
---|
选择器级别 4 # the-current-pseudo |
浏览器兼容性
没有浏览器实现此功能。