我被要求为平板电脑制作不同的响应式布局,具体取决于它们是否为高像素密度显示器。
此代码将以横向方式定位iPhone 5s,但似乎无法正常工作。有可能吗?
@media
only screen ( min-width: 568px) and (-webkit-min-device-pixel-ratio: 1.25),
only screen ( min-width: 568px) and ( min--moz-device-pixel-ratio: 1.25),
only screen ( min-width: 568px) and ( -o-min-device-pixel-ratio: 1.25/1),
only screen ( min-width: 568px) and ( min-device-pixel-ratio: 1.25),
only screen ( min-width: 568px) and ( min-resolution: 200dpi),
only screen ( min-width: 568px) and ( min-resolution: 1.25dppx)
{
body {
background-color: maroon;
}
}
通过在查询中嵌入min-width来显示dpi,它似乎正在工作(我还没有在大型设备上测试过)。我从来没有听说过这样做,这样做是否安全?
@media
only screen and (-webkit-min-device-pixel-ratio: 1.25),
only screen and ( min--moz-device-pixel-ratio: 1.25),
only screen and ( -o-min-device-pixel-ratio: 1.25/1),
only screen and ( min-device-pixel-ratio: 1.25),
only screen and ( min-resolution: 200dpi),
only screen and ( min-resolution: 1.25dppx)
{
@media only screen and ( min-width: 568px) {
body {
background-color: maroon;
}
}
}
答案 0 :(得分:2)
and
only screen
@media only screen and ( min-width: 568px)
检查我的mac book pro哪个在safari上有像素比率> 1.另请注意,在and
only screen