CSS display-mode Media Feature

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The display-mode media feature tests how the web app is shown: a normal browser tab, an installed PWA, fullscreen, or other presentation modes.

PWAs often set a preferred mode with the Web App Manifest display member. Fullscreen and Picture-in-Picture can also come from browser APIs. This is not the same as the display property, which controls element layout.

Baseline · Widely available.

Not deprecated. Core values (browser, standalone, fullscreen, minimal-ui) are widely supported; newer modes vary by browser.

Limited support:

picture-in-picture and window-controls-overlay need modern engines. Treat them as progressive enhancements.

CSS Syntax

syntax.css
@media (display-mode: browser | standalone | minimal-ui | fullscreen | …) { … }

Always wrap the feature in parentheses. Example: @media (display-mode: standalone) { … }

Feature Values

ValueDescriptionTry it
browserNormal browser tab or window with browser UITry it
standaloneInstalled app feel; navigation chrome usually hiddenTry it
minimal-uiStandalone-like with a small set of browser controlsTry it
fullscreenUses the full display; no browser chromeTry it
picture-in-pictureFloating always-on-top window (Document PiP)Try it
window-controls-overlayDesktop PWA with window controls overlay enabledTry it

How to Use display-mode

Style for a normal tab first, then enhance for installed or fullscreen contexts.

  1. Ship a good default layout for browser (everyday tabs).
  2. Add @media (display-mode: standalone) for installed PWA tweaks (hide install UI, adjust safe areas).
  3. Optional: style fullscreen, minimal-ui, or newer modes when your app uses them.
  4. Combine with other queries when needed (for example prefers-color-scheme inside Picture-in-Picture).
PieceRequired?Role
@mediaYesWraps the media feature
Mode keywordYesbrowser, standalone, …
Default stylesYesMust work in a normal browser tab
Manifest / APIs—How the mode is requested (PWA, Fullscreen, PiP)

Live Preview

This page’s current display-mode, via matchMedia. In a normal tab you should see browser match.

Detected display-mode queries

Install as a PWA or enter fullscreen to see other modes match.

Mode detection
(display-mode: browser) (display-mode: standalone) (display-mode: minimal-ui) (display-mode: fullscreen) (display-mode: picture-in-picture) (display-mode: window-controls-overlay)

Checking…

CSS Examples

Each snippet focuses on display-mode. Extra styles stay minimal for study. Use Try It Yourself for a live editor.

Example 1 — Style an Installed PWA

Hide an install tip when the app already runs as standalone.

CSS
<style>
  .install {
    padding: 8px;
    background: #fef3c7;
  }

  @media (display-mode: standalone) {
    .install {
      display: none;
    }
  }
</style>

<p class="install">Install this app for a home-screen icon.</p>
<p>Main content</p>
Try It Yourself

How It Works

  1. Default tip. The install message shows in a normal browser tab.
  2. Query standalone. @media (display-mode: standalone) matches an installed PWA.
  3. Hide the tip. display: none removes install UI that is no longer needed.
  4. Content stays. Main content is unchanged in every mode.

Example 2 — Fullscreen Layout Tweaks

Remove page margin and add a clear edge when fullscreen.

CSS
<style>
  body {
    margin: 16px;
  }

  @media (display-mode: fullscreen) {
    body {
      margin: 0;
      border: 5px solid #0f172a;
    }
  }
</style>

<p>App content</p>
Try It Yourself

How It Works

  1. Tab default. Normal pages keep a small margin.
  2. Detect fullscreen. The query matches Fullscreen API or manifest fullscreen.
  3. Edge to edge. Margin drops to 0 so content can use the whole screen.
  4. Visible frame. A border can help during demos; remove it in real apps if you prefer.

Example 3 — Browser-Only Banner

Show a banner only while the page runs in a normal tab.

CSS
<style>
  .banner {
    display: none;
    padding: 8px;
    background: #dbeafe;
  }

  @media (display-mode: browser) {
    .banner {
      display: block;
    }
  }
</style>

<p class="banner">You are in a browser tab.</p>
<p>Main content</p>
Try It Yourself

How It Works

  1. Hidden by default. The banner starts with display: none.
  2. Match browser. In a regular tab, (display-mode: browser) is true.
  3. Show the banner. The media block sets display: block.
  4. Other modes. Installed or fullscreen sessions keep the banner hidden.

Edge Cases & Pitfalls

If the wrong mode styles apply, check these first.

vs display

Not the display property

display: flex is layout. display-mode is presentation context (tab vs PWA).

manifest

Requested mode may differ

A browser may not honor the exact manifest display value. The media feature reports the mode that is actually in use.

testing

DevTools can emulate

Some browsers let you emulate display modes for CSS debugging. Real install/fullscreen is still the best check.

scope

Top-level context

The value applies to the top-level browsing context and its children — useful for nested frames in the same app shell.

newer

PiP and overlay are optional

Do not require picture-in-picture or window-controls-overlay for core UX. Enhance when they match.

Browser Support

display-mode is a browser media feature. Node.js, Deno, and Bun do not evaluate it.

✓ Baseline · Widely available

display-mode

Core values are widely available (about Chrome 42+, Firefox 47+, Safari 13+, Edge 79+). picture-in-picture and window-controls-overlay need newer engines.

95% Core support
Google Chrome 42+
Full support
Mozilla Firefox 47+
Full support
Apple Safari 13+
Full support
Microsoft Edge 79+
Full support
Opera 29+
Full support
Samsung Internet 5+
Full support
Internet Explorer —
No support
@media (display-mode) Widely supported

Bottom line: Safe for PWA and fullscreen progressive enhancement. Newer modes are optional. It is not a JavaScript runtime API.

Key Takeaways

  • Role: detect tab vs installed app vs fullscreen presentation.
  • Core values: browser, standalone, minimal-ui, fullscreen.
  • Not display: layout property ≠ presentation media feature.
  • Practice: default for tabs; enhance for standalone/fullscreen.

One line: @media (display-mode: …) styles the page based on how it is launched or shown.

Frequently Asked Questions

It tests how the page is presented: a normal browser tab, an installed PWA (standalone), fullscreen, minimal browser chrome, and a few newer modes. Use it inside @media to adapt layout and UI chrome.
Common values are browser, standalone, minimal-ui, and fullscreen. Newer values include picture-in-picture and window-controls-overlay.
display-mode is a media feature about app presentation (tab vs PWA vs fullscreen). The display property controls element layout (block, flex, none).
Typical uses: hide install prompts in standalone, tighten spacing without browser chrome, or style fullscreen and Picture-in-Picture layouts.
Yes. In a regular browser tab or window, display-mode is usually browser.
No. It is a CSS media feature evaluated by the browser layout engine, not a Node.js or server runtime feature.

Next: grid

Learn the grid media feature for grid vs bitmap output devices.

grid tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful