css - 媒体查询如何检测全高清智能手机?

标签 css responsive-design media-queries

如果媒体查询检查设备上的像素数, 它如何区分桌面全高清显示器和全高清智能手机?

显然两者的设计非常不同(CSS 方面)..

最佳答案

你可以通过像素密度来做到这一点。

@media only screen (-moz-min-device-pixel-ratio: 2), 
only screen and (-o-min-device-pixel-ratio: 2/1), 
only screen and (-webkit-min-device-pixel-ratio: 2), 
only screen and (min-device-pixel-ratio: 2) {
 /*This will be high ppi smart phone*/
}

关于css - 媒体查询如何检测全高清智能手机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17662886/

相关文章:

javascript - 没有为 CSS 使用外部样式表会导致我的代码无法执行吗?

html - 仅 IE 浏览器使用绝对定位权?

html - 响应图像网格上的动态高度?

html - 媒体查询宽度 100% 不起作用

html - jQuery 菜单管理(函数)——打开和关闭

css - 使用不同的媒体查询方法的响应式布局行为

html - CSS:使用最大宽度和最大高度在响应式 img 中保持纵横比

css - Bootstrap : using both the top and bottom fixed navbar for different widths

css - 响应式设计的多重媒体查询声明

CSS:100% 高度问题