Chrome 158: CSS Media Pseudo-Classes for Video Players
Chrome 158 reached stable on November 17, 2026, and it ships a set of CSS selectors that custom media players have been faking for more than a decade: :playing, :paused, :seeking, :buffering, :stalled, :muted and :volume-locked. They are enabled by default, and media element pseudo-classes are a focus area in Interop 2026.
The problem: state lives in JavaScript, styling lives in CSS
A <video> element knows whether it is paused. CSS never did. So every custom player ends up with a block of glue code whose only job is to copy playback state onto a class name:
const video = document.querySelector("video");
const shell = document.querySelector(".player");
for (const type of ["play", "pause", "waiting", "playing", "volumechange"]) {
video.addEventListener(type, () => {
shell.classList.toggle("is-paused", video.paused);
shell.classList.toggle(
"is-buffering",
!video.paused && video.networkState === 2 && video.readyState <= 2,
);
});
}This is where player bugs live. Miss an event and the spinner never disappears. Attach the listeners after a cached video has already started, and the first state is wrong. Render the shell on the server and the markup ships with no state at all until hydration catches up.
What changed
The HTML Living Standard now defines the state itself as selectable. The conditions are narrow and mechanical:
:playingmatches a media element whosepausedattribute is false, and:pausedmatches when it is true.:seekingmatches while theseekingattribute is true.:bufferingmatches whenpausedis false,networkStateisNETWORK_LOADING, andreadyStateisHAVE_CURRENT_DATAor lower.:stalledmatches elements that already match:bufferingand have been stalled long enough to warrant player UI.:mutedmatches muted elements.:volume-lockedmatches when the user agent has locked volume control — an iOS-style hardware decision, not an author one.
A practical example
The glue code above collapses into selectors. Sibling combinators reach the controls, and :has() reaches the shell:
/* Toggle the play and pause icons from media state. */
video:paused ~ .controls .icon-play { display: block }
video:playing ~ .controls .icon-play { display: none }
/* The spinner no longer needs a class to be toggled onto it. */
video:buffering ~ .controls .spinner { opacity: 1 }
video:stalled ~ .controls .spinner { animation-duration: 2s }
/* Volume: author-controlled mute vs. a locked user agent. */
video:muted ~ .controls .icon-mute { display: block }
video:volume-locked ~ .controls .volume-slider { display: none }
/* Reach the ancestor instead of a sibling. */
.player:has(video:buffering) { cursor: progress }
.player:has(video:paused) .overlay { opacity: 1 }Real-world caveats
These are not Baseline. MDN still marks them as limited availability, which means the JavaScript path stays until support broadens. Feature-detect rather than assume:
@supports selector(:playing) {
/* Drop the class-based rules here. */
}`:paused` is true before the first play. The condition is the paused attribute, not "the user pressed pause". A fresh page load matches :paused, so a pause overlay written naively appears over the poster frame. Scope it to a shell class your player sets once playback has been requested.
`:buffering` implies `:playing`. Both match at the same time, because buffering is defined on paused being false. A :playing rule and a :buffering rule will compete, and the cascade decides, not the state. Order them deliberately.
`:stalled` is not the `stalled` event. The event fires regardless of playback or ready state; the pseudo-class is the narrower "we have been buffering too long" case that a spinner should respond to.
They match the media element only. Styling a wrapper, a toolbar or a page background means ~, + or :has() — and :has() on a frequently changing state is worth measuring on long pages.
Takeaway
The win is not shorter CSS. It is deleting the class of bug where the DOM and the player disagree about what is on screen, because there is no longer a second copy of the state to go stale. Chrome 158 — the same release that removes XSLT — is where that becomes testable in production, behind a feature query.
Primary source: HTML Living Standard — Pseudo-classes and the Chrome 158 release notes.