`display-mode` CSS media feature
Baseline Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
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
displaymember in its manifest. In this case, the value ofdisplay-modeidentifies 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-modeidentifies the mode that was set.
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.
-
browser - The application opens in a conventional browser tab or new window, depending on the browser and platform.
-
fullscreen - All of the available display area is used and no user agent chrome is shown. This can be used to apply CSS only when the app has been put in fullscreen mode by the Fullscreen API or by using the
fullscreenvalue of thedisplaymember of the Wep App Manifest. -
minimal-ui - The application will look and feel like a standalone application, but will have a minimal set of UI elements for controlling navigation. The elements will vary by browser.
-
picture-in-picture - This mode allows users to continue consuming specific content while they interact with other sites or applications on their device. The app is displayed in a floating and always-on-top window. This can be used to apply CSS only when the app has been put in Picture-in-Picture mode by the Document Picture-in-Picture API.
-
standalone - The application will look and feel like a standalone application. This can include the application having a different window, its own icon in the application launcher, etc. In this mode, the user agent will exclude UI elements for controlling navigation, but can include other UI elements such as a status bar.
-
window-controls-overlay - In this mode, the application looks and feels like a standalone desktop application, and the Window Controls Overlay feature is enabled.
Examples
Apply CSS if the application is in fullscreen mode
@media (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 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
| Specification |
|---|
| Media Queries Level 5 # display-modes |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | |
display-mode |
42 |
79 |
47 |
29 |
13 |
42 |
47 |
29 |
12.2 |
4.0 |
42 |
12.2 |
browser |
42 |
79 |
47 |
29 |
13In a Safari browser window,display-mode: browser is always true, even in a macOS Full Screen window or when using the Fullscreen API. In an installed web application, other display-mode values are true only when given by a supported manifest display member value. See mdn/browser-compat-data#18807 (comment). |
42 |
116
47–116display-mode: browser is always true. |
29 |
12.2In the Safari app,display-mode: browser is always true, even when using the Fullscreen API. In an installed web application, other display-mode values are true only when given by a supported manifest display member value. See mdn/browser-compat-data#18807 (comment). |
4.0 |
42 |
12.2In the Safari app,display-mode: browser is always true, even when using the Fullscreen API. In an installed web application, other display-mode values are true only when given by a supported manifest display member value. See mdn/browser-compat-data#18807 (comment). |
fullscreen |
47 |
79 |
47In Firefox's "Full Screen" user interface, browser tabs and other user interface appear butdisplay-mode: fullscreen is true. |
No |
13In a Safari browser window,display-mode: fullscreen is never true, even when using the Fullscreen API. See mdn/browser-compat-data#18807 (comment). |
No |
116 |
No |
12.2In the Safari app,display-mode: fullscreen is never true, even when using the Fullscreen API. See mdn/browser-compat-data#18807 (comment).In an installed web application with the display manifest member set to standalone, display-mode: fullscreen is true, even though the system status bar is visible. See bug 264218. |
No |
No |
12.2In the Safari app,display-mode: fullscreen is never true, even when using the Fullscreen API. See mdn/browser-compat-data#18807 (comment).In an installed web application with the display manifest member set to standalone, display-mode: fullscreen is true, even though the system status bar is visible. See bug 264218. |
minimal-ui |
42 |
79 |
57Before Firefox 142,display-mode: minimal-ui is never true. From Firefox 142, it is true for progressive web apps pinned to the Windows taskbar. |
29 |
13display-mode: minimal-ui is never true. |
42 |
116 |
29 |
12.2display-mode: minimal-ui is never true. |
4.0 |
42 |
12.2display-mode: minimal-ui is never true. |
picture-in-picture |
123 |
123 |
151 |
109 |
No |
No |
151 |
No |
No |
No |
No |
No |
standalone |
42 |
79 |
57display-mode: standalone is never true. |
29 |
13 |
42 |
116 |
29 |
12.2In an installed web application with thedisplay manifest member set to standalone, display-mode: standalone is false and display-mode: fullscreen is true. See bug 264218. |
4.0 |
42 |
12.2In an installed web application with thedisplay manifest member set to standalone, display-mode: standalone is false and display-mode: fullscreen is true. See bug 264218. |
window-controls-overlay |
105 |
105 |
No |
91 |
No |
No |
No |
No |
No |
No |
No |
No |
See also
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/display-mode