13

在使用 CSS 媒体查询来获取设备像素密度时,我同时看到了-moz-min-device-pixel-ratiomin--moz-device-pixel-ratio.

例如:

@media 
  only screen and (-moz-min-device-pixel-ratio: 1.5) {
  /* styles go here */
}

对比

@media 
  only screen and (min--moz-device-pixel-ratio: 1.5) {
  /* styles go here*/
}

哪个是对的?

一些使用前者的教程/博客:

一些使用后者的教程/博客,包括 mozilla.org:

4

2 回答 2

19

第二个是正确的。

这是来自http://www.quirksmode.org/blog/archives/2012/07/vendor_prefixes.html

-webkit-min-device-pixel-ratio: 1.5
min--moz-device-pixel-ratio: 1.5
-o-min-device-pixel-ratio: 3/2
于 2012-07-11T06:42:08.240 回答
2

我是上面提到的威胁性云文章的作者。我的文章中列出的设备像素比是不正确的,因为它是很久以前写的(iPhone4 发布)。

它已更新以引用正确的 Mozilla 语法。

我不知道为什么 Mozilla 选择使用 min--moz-device-pixel-ratio,但这似乎是官方选择的形式。

于 2012-07-12T12:33:15.467 回答