Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. CSS
  3. Reference
  4. At-rules
  5. @media
  6. display-mode

display-mode

Limited availability

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

Thedisplay-modeCSSmedia 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:

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

Syntax

Thedisplay-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 agentchrome is shown. This can be used to apply CSS only when the app has been put in fullscreen mode by theFullscreen API or by using thefullscreen value of thedisplay member 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 theDocument 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 theWindow Controls Overlay feature is enabled.

Examples

Apply CSS if the application is in fullscreen mode

css
@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 thedisplay-mode: picture-in-picture value with theprefers-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.

css
@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;  }}

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

Specifications

Specification
Media Queries Level 5
# display-modes

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp