此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

:future

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

CSS :future 伪类选择器是一种时间维度伪类,用于匹配那些完全出现在匹配 :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="Chinese" kind="subtitles" srclang="zh" src="subtitles.vtt" default /> </video> 

WebVTT

WEBVTT FILE 1 00:00:03.500 --> 00:00:05.000 这是第一条字幕 2 00:00:06.000 --> 00:00:09.000 这是第二条字幕 3 00:00:11.000 --> 00:00:19.000 这是第三条字幕 

规范

Specification
Selectors Level 4
# the-future-pseudo

浏览器兼容性

参见