:future

可用性有限

此特性不是基线特性,因为它在一些最广泛使用的浏览器中不起作用。

:future CSS 伪类选择器是一种时间维度伪类,它将匹配在匹配 :current 的元素之后完全出现的任何元素。例如,在通过 WebVTT 显示字幕的视频中。

css
:future(p, span) {
  display: none;
}

语法

css
:future {
  /* ... */
}

示例

CSS

css
:future(p, span) {
  display: none;
}

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

规范

规范
选择器 Level 4
# the-future-pseudo

浏览器兼容性

另见