:past

Limited availability

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

:past là bộ chọn lớp giả CSS theo chiều thời gian, khớp với bất kỳ phần tử nào xuất hiện hoàn toàn trước một phần tử khớp với :current. Ví dụ như trong video có phụ đề đang được hiển thị qua WebVTT.

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

Cú pháp

css
:past {
  /* ... */
}

Ví dụ

CSS

css
:past(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="vi"
    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

Thông số kỹ thuật

Specification
Selectors Level 4
# the-past-pseudo

Khả năng tương thích trình duyệt

Xem thêm