gpt4 book ai didi

ios - @media iphone 5 和 6 查询

转载 作者:太空宇宙 更新时间:2023-11-04 02:53:09 25 4
gpt4 key购买 nike

我正在尝试应用字体和背景颜色,具体取决于我使用的是 iphone 5 还是 6。查询中存在重叠,因此它总是属于最后一个查询。如何为 iphone 5 和 6 应用 CSS?

/*iPhone6 Portrait and Landscape*/
@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px) {
body {
background-color: red;
font-size:16px;
}
}

/*iPhone5 Portrait and Landscape*/
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px){
body {
background-color: lightblue;
font-size:12px;
}
}

最佳答案

这可能对您iphone 5、iphone 6 和 iphone 6+ 有帮助。

/* ----------- iPhone 5 and 5S ----------- */
/* Portrait and Landscape */
@media only screen and
(min-device-width: 320px) and (max-device-width: 568px) and
(-webkit-min-device-pixel-ratio: 2) {

}

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

/* Landscape */
@media only screen
and (min-device-width: 320px)
and (max-device-width: 568px)
and (-webkit-min-device-pixel-ratio: 2)
and (orientation: landscape) {

}

/* ----------- iPhone 6 ----------- */

/* Portrait and Landscape */
@media only screen
and (min-device-width: 375px)
and (max-device-width: 667px)
and (-webkit-min-device-pixel-ratio: 2) {

}

/* Portrait */
@media only screen
and (min-device-width: 375px)
and (max-device-width: 667px)
and (-webkit-min-device-pixel-ratio: 2)
and (orientation: portrait) {

}

/* Landscape */
@media only screen
and (min-device-width: 375px)
and (max-device-width: 667px)
and (-webkit-min-device-pixel-ratio: 2)
and (orientation: landscape) {

}

/* ----------- iPhone 6+ ----------- */

/* Portrait and Landscape */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (-webkit-min-device-pixel-ratio: 3) {

}

/* Portrait */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (-webkit-min-device-pixel-ratio: 3)
and (orientation: portrait) {

}

/* Landscape */
@media only screen
and (min-device-width: 414px)
and (max-device-width: 736px)
and (-webkit-min-device-pixel-ratio: 3)
and (orientation: landscape) {

}

来源:CSS-tricks

关于ios - @media iphone 5 和 6 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32670424/

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