Media element pseudo-classes
The :playing, :paused, :seeking, :buffering, :stalled, :muted, and :volume-locked CSS pseudo-classes match <audio> and <video> elements based on their state.
Overview
The :playing, :paused, :seeking, :buffering, :stalled, :muted, and :volume-locked CSS pseudo-classes match <audio> and <video> elements based on their state.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| | | 150 | 15.4 | | 15.4 | |
| Other | ||||||
| `:muted` | | | 150 | 15.4 | | 15.4 |
| `:paused` | | | 150 | 15.4 | | 15.4 |
| `:playing` | | | 150 | 15.4 | | 15.4 |
| `:seeking` | | | 150 | 15.4 | | 15.4 |
| `:stalled` | | | 150 | 15.4 | | 15.4 |
| `:volume-locked` | | | 150 | 15.4 | | 15.4 |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
CSS
video:playing {
outline: 2px solid green;
}
video:paused {
opacity: 0.7;
}
audio:muted {
filter: grayscale(1);
} Live demo
Use cases
Using Media element pseudo-classes
The :playing, :paused, :seeking, :buffering, :stalled, :muted, and :volume-locked CSS pseudo-classes match <audio> and <video> elements based on their state.
Cautions
- Limited browser support. Check compatibility before use.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.
Related links
Powered by web-features