非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
弃用
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 the
兼容性表格
at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
-moz-device-pixel-ratio
Gecko-only
CSS
media feature
can be used to apply styles based on the number of device pixels per CSS pixel.
Do not use this feature.
使用
resolution
feature with the
dppx
unit instead.
-webkit-device-pixel-ratio
. The min and max prefixes as implemented by Gecko are named
min--moz-device-pixel-ratio
and
max--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
.
<number>
The number of device pixels per CSS pixel.
Media:
media/visual
Accepts min/max prefixes:
yes
-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 support
dppx
.
范例:
@media (-webkit-min-device-pixel-ratio: 2), /* Webkit-based browsers */
(min--moz-device-pixel-ratio: 2), /* Older Firefox browsers (prior to Firefox 16) */
(min-resolution: 2dppx), /* The standard way */
(min-resolution: 192dpi) /* dppx fallback */
注意
: See this
CSSWG article
for compatibility good practices regarding
resolution
and
dppx
.
Not part of any standard.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
-moz-device-pixel-ratio
media feature
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 完整支持 4 | IE 不支持 No | Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 完整支持 4 | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。