Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. CSS
  3. Reference
  4. At-rules
  5. @media
  6. -moz-device-pixel-ratio

-moz-device-pixel-ratio

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The-moz-device-pixel-ratio Gecko-onlyCSSmedia feature can be used to apply styles based on the number of device pixels per CSS pixel.

Warning:Do not use this feature. Use theresolution feature with thedppx unit instead.

Note:This media feature is also implemented by WebKit as-webkit-device-pixel-ratio. The min and max prefixes as implemented by Gecko are namedmin--moz-device-pixel-ratio andmax--moz-device-pixel-ratio; but the same prefixes as implemented by WebKit are named-webkit-min-device-pixel-ratio and-webkit-max-device-pixel-ratio.

Syntax

<number>

The number of device pixels per CSS pixel.

Media:@mediaAccepts min/max prefixes: yes

Examples

Basic compatibility example

-moz-device-pixel-ratio may be used for compatibility with Firefox older than 16, and alongside-webkit-device-pixel-ratio for compatibility with WebKit-based browsers that do not supportdppx.

Example:

css
/* First, set for WebKit-based browsers */@media (-webkit-min-device-pixel-ratio: 2),  (min--moz-device-pixel-ratio: 2) /* Older Firefox browsers (prior to firefox 16) */,  (min-resolution: 2dppx) /* The standard way */,  (min-resolution: 192dpi); /* dppx fallback */

Note:See thisCSSWG article for compatibility good practices regardingresolution anddppx.

Specifications

Not part of any standard.

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp