The :fullscreen pseudo-class matches an element that is currently in fullscreen mode. Use it to change background, size, or layout only while that element fills the screen.
CSS cannot turn fullscreen on by itself. A user gesture must call element.requestFullscreen() (or native video controls). Then your :fullscreen rules apply automatically.
Limited availability.
Supported in modern Chromium, Firefox, and Safari, but MDN marks it as not fully Baseline across every widely used browser. Prefer feature detection for critical UI.
Legacy prefixes.
Old engines used :-webkit-full-screen and :-moz-full-screen. New code should use standard :fullscreen.
Syntax
CSS Syntax
syntax.css
:fullscreen{ /* styles */ }
Often combined with an element or class: .panel:fullscreen, video:fullscreen.
Forms
Selector Forms
:fullscreen is a state selector — it has no property values. Common patterns:
Native controls can enter fullscreen; video:fullscreen styles that state.
How It Works
Target the media.video:fullscreen matches only while the video is fullscreen.
Fill the screen. Width/height and object-fit keep the picture readable.
Use native UI or JS. Either path can put the video into fullscreen.
Keep accessibility. Provide captions and keyboard-friendly controls on the page.
Edge Cases & Pitfalls
Most issues are gesture requirements, iframes, or confusing CSS with the API.
api
CSS cannot enter fullscreen
:fullscreen only styles an element that is already fullscreen via the API or media controls.
gesture
User gesture required
requestFullscreen() must run from a click or similar user action, not from automatic page load.
iframe
Iframes need permission
Embedded frames often need allow="fullscreen" or fullscreen may be blocked.
legacy
Old prefix selectors
:-webkit-full-screen and :-moz-full-screen are legacy. Prefer :fullscreen for new stylesheets.
escape
Users can always exit
Escape leaves fullscreen. Design UI that still makes sense after exit.
Compatibility
Browser Support
:fullscreen is a browser CSS pseudo-class tied to the Fullscreen API. Node.js, Deno, and Bun do not apply it.
✓ Limited availability
:fullscreen
Supported in modern Chrome, Edge, Firefox, Safari, and Opera. Check current MDN compatibility for edge cases.
90%Modern browsers
Google Chrome71+
Full support
Mozilla Firefox64+
Full support
Apple Safari16.4+
Full support
Microsoft Edge79+
Full support
Opera58+
Full support
Samsung Internet10+
Full support
:fullscreenModern support
Bottom line: Use the standard :fullscreen selector in modern apps. Feature-detect requestFullscreen for critical flows. Not a server runtime API.
Remember
Key Takeaways
Role: style an element only while it is fullscreen.
API: enter with requestFullscreen() on a user gesture.
Backdrop: optional ::backdrop for the layer behind.
Tip: Escape exits; design for both fullscreen and normal layouts.
One line::fullscreen styles the fullscreen state; JavaScript (or media UI) enters that state.
Frequently Asked Questions
It matches an element that is currently displayed in fullscreen mode. Use it to change size, color, or layout only while that element fills the screen.
No. Entering fullscreen needs the Fullscreen API (element.requestFullscreen()) or native media controls. CSS only styles the element after it is already fullscreen.
Browsers require a user gesture (like a click). Calls from timers or page load without a gesture are blocked. Some iframes also need allow="fullscreen".
::backdrop styles the layer behind a fullscreen element. Use it to dim or color the area outside the fullscreen content.
Modern browsers support :fullscreen. Very old engines used :-webkit-full-screen or :-moz-full-screen. Prefer the standard selector for new code.
No. It is a browser CSS pseudo-class. Node.js, Deno, and Bun do not apply it.