我正试图在iPhone屏幕上激活媒体查询,但它不会在我的iPhone 5上触发。我的CSS是:
@media only screen and (max-width: 550px) {
.left-col-bio { width: 100%; }
.sidebar-bio { width: 100%; }
.left-col-lab { width: 100%; }
.sidebar-lab { width: 100%; }
}
这应该在iPhone 5上触发,不应该吗?由于iPhone的宽度是320个虚拟像素,对吗?在我看过的相关问题中,人们经常建议包括
<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1">
但我已经有了。我只有一个iPhone 5来测试它,所以我不确定它是否在非视网膜屏幕上正确显示,如果存在问题。有什么建议?感谢。
答案 0 :(得分:1)
iPhone5
@media screen and (device-aspect-ratio: 40/71) {
}
or
@media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2){
}
Blackberry Torch
@media screen and (max-device-width: 480px) {
}
三星S3
@media only screen and (-webkit-device-pixel-ratio: 2) {
}
Google Nexus 7
@media screen and (device-width: 600px) and (device-height: 905px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) {
}
iPad Mini
@media screen and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 1) {
}
iPad 3
@media (max-device-width: 768px) and (orientation: portrait) {
}
Galaxy Tab 10.1
@media (max-device-width: 800px) and (orientation: portrait) {
}