files/en-us/web/css/reference/at-rules/@media/display-mode/index.md
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:
A progressive web app can set its display mode by setting the display member in its manifest. In this case, the value of display-mode identifies the value that was set (but note that this may not be the same as the value requested in the manifest, since a browser may not support the requested mode).
Any web app can use the Fullscreen API or the Document Picture-in-Picture API to set the display mode, and in this case the value of display-mode identifies the mode that was set.
The display-mode value applies to the top-level browsing context and any child browsing contexts.
The display-mode feature is specified as a keyword value chosen from the list below.
browser
fullscreen
fullscreen value of the display member of the Wep App Manifest.minimal-ui
picture-in-picture
standalone
window-controls-overlay
@media (display-mode: fullscreen) {
body {
margin: 0;
border: 5px solid black;
}
}
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: #333333;
}
a {
color: antiquewhite;
}
}
See Using the Document Picture-in-Picture API for more information and a full example.
{{Specifications}}
{{Compat}}