`
squall140
  • 浏览: 150218 次
  • 性别: 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 */ }
分享到:
评论

相关推荐

    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

    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 ...

    Objective-C for Absolute Beginners: iPhone and Mac Programming Made Easy

    iPhone and Mac Programming Made Easy," is designed specifically for those who are new to programming and wish to start developing applications for Apple devices such as iPhones, iPads, and Mac ...

    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...

    web网页设计期末课程大作业 基于HTML+CSS仿苹果商城电商项目的设计与实现

    - 使用外部CSS文件(如`iPads.css`),便于样式管理与维护。 - **页面结构**:页面顶部通常有一个100%宽度的导航栏,包含了网站的主要菜单项,便于用户导航;底部也通常有一个固定宽度的区域用于放置版权信息和其他...

    Real-Time Document Collaboration Using iPads

    ### 实时文档协作使用iPad的研究知识点 #### 一、研究背景与目的 本文档探讨了在iPad上实现的实时文档协作界面,旨在为阅读小组提供一个便捷高效的协作平台。研究利用了iPad轻便且便于携带的特点,使得用户能够在...

    苹果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"表明这是一个与操作系统课程相关的学习资源包,来源于上海交通大学的IPADS实验室。"每个实验放在独立分支"意味着...

    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 ...

    2018_2019学年高考英语一轮复习Unit24Society高考试卷分块专练北师大版选修8

    它免费适用于iPads和iPhones,也有付费版本提供更多信息。 5. HappyCow app:专为素食者和纯素者设计,用户可以搜索全球的素食餐厅和商店。HappyCow有免费的Android版本,但包含广告且需要网络连接。 6. LocalEats...

    Apress Learn Cocos2D

    Cocos2D is a powerful 2D game development framework designed specifically for iOS devices such as iPhones and iPads. The framework simplifies the process of creating engaging and interactive 2D games ...

Global site tag (gtag.js) - Google Analytics