`
squall140
  • 浏览: 140911 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

CSS Media Queries for iPads & iPhones

阅读更多

iPhone 5 Media Queries

iPhone 5 in portrait & landscape

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 568px) { /* STYLES GO HERE */}

iPhone 5 in landscape

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 568px) 
and (orientation : landscape) { /* STYLES GO HERE */}

iPhone 5 in portrait

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 568px) 
and (orientation : portrait) { /* STYLES GO HERE */ }

iPhone 2G, 3G, 4, 4S Media Queries

It's noteworthy that these media queries are also the same for iPod Touch generations 1-4.

iPhone 2G-4S in portrait & landscape

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) { /* STYLES GO HERE */}

iPhone 2G-4S in landscape

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) 
and (orientation : landscape) { /* STYLES GO HERE */}

iPhone 2G-4S in portrait

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) 
and (orientation : portrait) { /* STYLES GO HERE */ }

iPhone 5 Resolution

Screen Width = 320px (CSS Pixels)
Screen Height = 568px (CSS Pixels)

Screen Width = 640px (Actual Pixels)
Screen Height = 1136px (Actual Pixels)

Device-pixel-ratio: 2

iPhone 4/4S Resolution

Screen Width = 320px (CSS Pixels)
Screen Height = 480px (CSS Pixels)

Screen Width = 640px (Actual Pixels)
Screen Height = 960px (Actual Pixels)

Device-pixel-ratio: 2

iPhone 2G/3G/3GS Resolution

Screen Width = 320px (CSS Pixels)
Screen Height = 480px (CSS Pixels)

Screen Width = 320px (Actual Pixels)
Screen Height = 480px (Actual Pixels)

Device-pixel-ratio: 1

Pad Media Queries (All generations - including iPad mini)

Thanks to Apple's work in creating a consistent experience for users, and easy time for developers, all 5 different iPads (iPads 1-5 and iPad mini) can be targeted with just one CSS media query. The next few lines of code should work perfect for a responsive design.

iPad in portrait & landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px)  { /* STYLES GO HERE */}

iPad in landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) { /* STYLES GO HERE */}

iPad in portrait

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) { /* STYLES GO HERE */ }

iPad 3 & 4 Media Queries

If you're looking to target only 3rd and 4th generation Retina iPads (or tablets with similar resolution) to add @2x graphics, or other features for the tablet's Retina display, use the following media queries.

Retina iPad in portrait & landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 2) { /* STYLES GO HERE */}

Retina iPad in landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 2) { /* STYLES GO HERE */}

Retina iPad in portrait

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 2) { /* STYLES GO HERE */ }

iPad 1 & 2 Media Queries

If you're looking to supply different graphics or choose different typography for the lower resolution iPad display, the media queries below will work like a charm in your responsive design!

iPad 1 & 2 in portrait & landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (-webkit-min-device-pixel-ratio: 1){ /* STYLES GO HERE */}

iPad 1 & 2 in landscape

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1)  { /* STYLES GO HERE */}

iPad 1 & 2 in portrait

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) 
and (-webkit-min-device-pixel-ratio: 1) { /* STYLES GO HERE */ }
分享到:
评论

相关推荐

    iOS 5 Essentials

    Apple's iOS platform, with iPads, iPhones, and iPod touches is the hottest thing in software development right now. An exquisite OS and hardware demands great development tools, and Apple has ...

    Powercharts 3.12.2

    官方最新powercharts 3.12.2,图表上无水印。支持最新的HTML5,跨平台。PCs, Macs, iPads, iPhones, Android devices, our JavaScript (HTML5) charts work everywhere. Heck, even on

    Apress 2014最新iOS、iphone开发书籍

    Apress 2014最新iOS、iphone开发书籍,EPUB格式 Apress Beginning iOS Media App Development (2014).epub ...Apress The Business of iOS App Development, For iPhones iPads and iPod touches 3rd (2014).epub

    fusioncharts-suite-xt-v3.12.1 破解版

    官方最新Fusioncharts 3.12.2,图表上无水印。支持最新的HTML5,跨平台。PCs, Macs, iPads, iPhones, Android devices, our JavaScript (HTML5) charts work everywhere. Heck, even on IE 6

    FusionCharts 3.12.2

    官方最新Fusioncharts 3.12.2,图表上无水印。支持最新的HTML5,跨平台。PCs, Macs, iPads, iPhones, Android devices, our JavaScript (HTML5) charts work everywhere. Heck, even on IE 6

    Odyssey-1.1.2.ipa

    IOS13.0-13.5越狱APP ... It's also a snappy, responsive experience that you can't find anywhere else, with full support for iOS 13.0-13.5 devices, including the latest iPads and iPhones.

    Learn Design for iOS Development.pdf

    Learn Design for iOS ... and from that insight you’ll be able to vision and create your own apps, on iPhones and iPads, that work perfectly within the new iOS 7 interface. Download PDF (4.6 MB)

    Real-Time Document Collaboration Using iPads

    Real-Time Document Collaboration Using iPads 论文

    Learn Design for iOS Development

    and from that insight you’ll be able to vision and create your own apps, on iPhones and iPads, that work perfectly within the new iOS 7 interface. What youll learn How to build apps that work ...

    iOS Game Development Developing Games for iPad, iPhone, and iPod Touch.pdf

    Recent announcements of increased AR capabilities on the latest iPhones and iPads show a clear dedication on Apple’s part to this emerging market of immersive games and apps. Unity 2017 is the latest...

    iOS 6 Programming Pushing the Limits

    App development for iPhones and iPads is a lucrative and exciting venture; books on this topic are steady bestsellers This advanced guide helps experienced developers take full advantage of the latest...

    苹果iOS5.0开始大规模终端测试

    5月2日消息,据国外媒体报道,苹果开始大规模测试iOS5操作系统,参与测试的设备包括iPods、iPads和iPhones,据悉连iPhone3GS也参与了测试。同时,已经有软件开发商正在进行iOS5.0的第三方软件兼容性测试,近日iOS...

    ios开发详细教程, ios代码大全, 苹果系统(ios)架构教程

    As of March 2018, Apple's App Store contains more than 2.1 million iOS applications, 1 million of which are native for iPads.[12] These mobile apps have collectively been downloaded more than 130 ...

    Woll2Woll FirePower Source Code v12.0.4.1 for Rio

    You can build one powerful and expressive app that runs smoothly on all your devices: iPhones and iPads, Android phones and tablets, Linux Systems (using FMXLinux), and MacBooks and Windows computers...

    PiChordoke:为 Raspberry Pi 编写的 Song Telepromter Server-开源

    Raspberry pi 2B 和 pi 3+ 计算机的一些音乐相关软件的免费测试版。 我收录了 20 多首免版税的圣诞曲调,我曾在歌词上添加和弦,然后... IPADS/IPHONES、ANDROIDS、LAPTOPS & DESKTOPS 可以连接到 PICHORDOKE 服务器。

    本仓库包含上海交通大学IPADS实验室设计的操作系统课程系列实验。每个实验放在独立分支。.zip

    本仓库包含上海交通大学IPADS实验室设计的操作系统课程系列实验。每个实验放在独立分支。.zip

    Scratch by Example: Programming for All Ages

    With a drag-and-drop interface that runs in any web browser, and on devices from iPads to PCs to Macs to Microsoft Surface tablets, Scratch is an easily accessible way to enter the world of computer ...

    beginning iOS AR Game development

    Recent announcements of increased AR capabilities on the latest iPhones and iPads show a clear dedication on Apple’s part to this emerging market of immersive games and apps. Unity 2017 is the latest...

    Enterprise iPhone and iPad Administrator's Guide

    Do you have fellow employees who are eager to use their iPhones and iPads for work? Then this is the book for you. Enterprise iPhone and iPad Administrator’s Guide provides step-by-step instructions...

    iPad The Missing Manual

    by the 300,000 iPads sold the day the tablet went on sale (April 3, 2010). So why has the iPad proven so popular when the whole tablet concept hasn’t exactly burned up the market? One theory: combine...

Global site tag (gtag.js) - Google Analytics