CSS -webkit-min-device-pixel-ratio: 2 代表什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9437584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 03:05:54  来源:igfitidea点击:

What does -webkit-min-device-pixel-ratio: 2 stand for?

iphonecssmedia

提问by Marin

@media only screen and (max-device-width:480px), 
only screen and (-webkit-min-device-pixel-ratio: 2)
{ /*iphone css*/ }

max-device widthmakes sense but pixel ratiodoesn't make any sense to me. thanks.

最大设备宽度有意义,但像素比对我没有任何意义。谢谢。

回答by j08691

From http://developer.android.com/reference/android/webkit/WebView.html

来自http://developer.android.com/reference/android/webkit/WebView.html

The -webkit-device-pixel-ratio CSS media query. Use this to specify the screen densities for which this style sheet is to be used. The corresponding value should be either "0.75", "1", or "1.5", to indicate that the styles are for devices with low density, medium density, or high density screens, respectively. For example: The hdpi.css stylesheet is only used for devices with a screen pixel ration of 1.5, which is the high density pixel ratio.

-webkit-device-pixel-ratio CSS 媒体查询。使用它来指定要使用此样式表的屏幕密度。相应的值应为“0.75”、“1”或“1.5”,分别表示样式适用于低密度、中密度或高密度屏幕的设备。例如: hdpi.css 样式表仅用于屏幕像素比为 1.5 的设备,这是高密度像素比。

And according to https://developer.mozilla.org/en/CSS/Media_queries

根据https://developer.mozilla.org/en/CSS/Media_queries

-moz-device-pixel-ratio

Gives the number of device pixels per CSS pixel.

Note: This media feature is also implemented by Webkit as -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.

-moz-device-pixel-ratio

给出每个 CSS 像素的设备像素数。

注意:此媒体功能也由 Webkit 实现为 -webkit-device-pixel-ratio。Gecko 实现的 min 和 max 前缀分别命名为 min--moz-device-pixel-ratio 和 max--moz-device-pixel-ratio;但与 Webkit 实现的相同的前缀被命名为 -webkit-min-device-pixel-ratio 和 -webkit-max-device-pixel-ratio。