display-mode - CSS: Cascading Style Sheets 编辑

The display-mode CSS media feature can be used to test the display mode of an application. You can use it to provide a consistent user experience between launching a site from a URL and launching it from a desktop icon.

This feature corresponds to the Web app manifest's display member. Both apply to the top-level browsing context and any child browsing contexts. The feature query applies regardless of whether a web app manifest is present.

Syntax

The display-mode feature is specified as a keyword value chosen from the list below.

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)

Examples

The CSS is used if the device is at fullscreen

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

Specifications

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

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:61 次

字数:3654

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文