在线文档教程
CSS

显示模式 | @media.display-mode

display-mode CSS @media媒体功能可基于应用程序的显示模式的风格用于应用样式。您可以使用它来提供从URL启动网站和从桌面图标启动网站之间的一致的用户体验。

该功能对应于Web应用程序清单的display成员。两者都适用于顶级浏览上下文和任何子浏览上下文。无论是否存在Web应用程序清单,功能查询都适用。

语法

display-mode功能被指定为从下面的列表中选择的关键字值。

Display modeDescriptionFallback display mode
fullscreenAll of the available display area is used and no user agent chrome is shown.standalone
standaloneThe 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.minimal-ui
minimal-uiThe 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.browser
browserThe application opens in a conventional browser tab or new window, depending on the browser and platform.(none)

例子

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

规范

SpecificationStatusComment
Web App ManifestThe definition of 'display-mode' in that specification.Working DraftInitial definition.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support46.0147 (47)2???

FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support??47 (47)2???46.01