:playing

Limited availability

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

:playing CSS 伪类选择器表示一个处于“播放”状态的可播放元素,例如 <audio><video>

如果用户明确地启动了播放,那么资源就被认为是正在播放。如果元素的确处于播放状态,但由于与用户意图无关的原因而被暂停,也被认为是正在播放。在这种情况下,一旦底层原因(如“缓冲”或“停滞”状态)得到解决,播放将自动恢复。

语法

css
:playing {
  /* ... */
}

示例

CSS

css
:playing {
  border: 5px solid green;
}

规范

Specification
Selectors Level 4
# selectordef-playing
HTML
# selector-playing

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
:playing

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

参见