:fullscreen

Limited availability

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

The :fullscreen CSS pseudo-class matches every element that is currently in fullscreen mode. If multiple elements have been put into fullscreen mode, this selects them all.

Syntax

css
:fullscreen {
  /* ... */
}

Usage notes

The :fullscreen pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between fullscreen and traditional presentations.

Examples

Styling a fullscreen element

This example applies a different background color to a

element, depending on whether or not it is in fullscreen mode. It includes a

The :fullscreen pseudo-class is used to override the background-color of the

when it is in fullscreen mode.

css
.element {
  background-color: lightyellow;
}

.element:fullscreen {
  background-color: lightpink;
}

The following JavaScript provides an event handler function that toggles fullscreen when the

Specifications

Specification
Selectors Level 4
# selectordef-fullscreen
Fullscreen API
# css-pc-fullscreen

Browser compatibility

See also