gpt4 book ai didi

css - 媒体屏幕查询在 iPhone 中不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:42 25 4
gpt4 key购买 nike

我需要 iPhone4(宽度:340;高度:480)和 iPhone 的 css 媒体查询
5(宽度:340;高度:570)。均采用纵向模式。

For iPhone 5 
@media only screen and (max-width : 340px) and (max-height : 570px)
{
body
{
position: absolute;
left: 0px;
top: 0px;
width: 340px;
height: 570px;
z-index: 45;
}
.row2
{
position: absolute;
left: 0px;
top: 0px;
width: 340px;
height: 570px;
z-index: 44;
}
._2_1
{
position: absolute;
left: 4px;
top: 151px;
width: 80px;
height: 78px;
z-index: 43;
}
}

For iPhone 4

@media only screen and (max-width : 340px) and (max-height : 480px)
{
/*styles*/
}

此代码在 iPhone 5 中不起作用。在 iPhone 5 中加载时,它使用 iPhone 4 的 css 加载

示例 CSS

@media only screen and max-width : 570px) {
body
{
position:absolute !important;
left: 0px;
top: 0px;
width: 340px;
height: 570px;
z-index: 45;
}
.row2 {
position:absolute !important;
left: 0px;
top: 0px;
width: 340px;
height: 570px;
z-index: 44;
}
._2_1 {
/*background-image: url("images/2 1.png");*/
position:absolute !important;
left: 4px;
top: 151px;
width: 80px;
height: 78px;
z-index: 43;
}
._2_2 {
position:absolute !important;
left: 118px;
top: 150px;
width: 82px;
height: 80px;
z-index: 42;
}
}.........
.......
}

最佳答案

试试这个

iPhone4

@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3)
{
...
}

仅适用于 iphone5(横向和纵向模式)

@media only screen and (min-device-width: 320px) and (max-device-width: 568px) 
and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40/71)
{
...
}

任何特定的模式说肖像

@media only screen and (min-device-width: 320px) and (max-device-width: 568px)
and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40/71) and (orientation:portrait)
{
...
}

Reference

关于css - 媒体屏幕查询在 iPhone 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20854016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com