简体   繁体   English

是否有iPhone 3特定的媒体查询?

[英]Is there a iPhone 3 specific media query?

background-size:cover does not seem to work on iPhone 3. I've read somewhere that using background-size:100%; background-size:cover似乎在iPhone 3上不起作用。我读过某处使用background-size:100%; instead should solve the problem, and it does. 而是应该解决问题,而且确实可以。 However, it makes the background on Iphone 4 look ugly. 但是,它使Iphone 4上的背景看起来很难看。

I've searched on the internet but all I find are queries for both the Iphone 3 and 4. Is there a media query for JUST the iPhone 3? 我已经在互联网上进行搜索,但发现的只是对Iphone 3和4的查询。是否有针对Iphone 3的媒体查询?

EDIT: I posted my solution in the answer below 编辑:我在下面的答案中发布了我的解决方案

I found a solution for my problem. 我找到了解决问题的方法。

This blog post has a list of media queries for specific iPhone versions. 这篇博客文章列出了针对特定iPhone版本的媒体查询。

<!-- iPhone 2G, 3G, 3GS Portrait -->
@media only screen and (device-width: 320px) and (orientation: portrait) and not (-webkit-min-device-pixel-ratio: 2) {
    /* CSS3 Rules for iPhone in Portrait Orientation */
}

<!-- iPhone 2G, 3G, 3GS Landscape -->
@media only screen and (device-width: 480px) and (orientation: landscape) and not (-webkit-min-device-pixel-ratio: 2) {
    /* CSS3 Rules for iPhone in Landscape Orientation */
}

As you can see it only targets up to 3GS. 如您所见,它只针对3GS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM