如果媒体查询检查设备上的像素数,它如何知道桌面全高清显示器和全高清智能手机之间的区别?
显然,两者的设计有很大的不同(css方面)。
发布于 2013-07-16 04:17:35
你可以通过像素密度来实现。
@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*/
}
发布于 2013-07-16 04:07:17
媒体查询对桌面浏览器和移动浏览器一无所知。最好的办法是使用JS来分析用户代理,或者执行一些功能测试。
https://stackoverflow.com/questions/17662886
复制相似问题