: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

瀏覽器相容性

另見