docs.rodeo

MDN Web Docs mirror

display-mode

{{CSSRef}} 

The display-mode CSS media feature can be used to test whether a web app is being displayed in a normal browser tab or in some alternative way, such as a standalone app or fullscreen mode.

For example:

The display-mode value applies to the top-level browsing context and any child browsing contexts.

Syntax

The display-mode feature is specified as a keyword value chosen from the list below.

Examples

Apply CSS if the application is in fullscreen mode

@media all and (display-mode: fullscreen) {
  body {
    margin: 0;
    border: 5px solid black;
  }
}

Provide a light and dark color scheme to Picture-in-Picture content

In this example, we combine the display-mode: picture-in-picture value with the {{cssxref("@media/prefers-color-scheme", "prefers-color-scheme")}}  media feature to create light and dark color schemes that are applied based on the user’s color scheme preference, only when the app is being shown in Picture-in-Picture mode.

@media (display-mode: picture-in-picture) and (prefers-color-scheme: light) {
  body {
    background: antiquewhite;
  }
}

@media (display-mode: picture-in-picture) and (prefers-color-scheme: dark) {
  body {
    background: #333;
  }

  a {
    color: antiquewhite;
  }
}

See Using the Document Picture-in-Picture API for more information and a full example.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN