iPad Media Queries

1、iPad Media Queries (所有版本,包括iPad mini)

iPads从第一代到至今,总共有五代,也就是iPad1~iPad5,以及Mini iPad。而且每一代iPad都具有相应的CSS Media Queries。这些代码能让你在的代码在iPads下更完美。

iPad (landscape和portrait)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* 样式写在这里 */
}

iPad (landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* 样式写在这里 */
}

iPad (portrait)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* 样式写在这里 */
}

2、iPad3和iPad4

iPad3和iPad4具有Retina屏幕技术,如果你想针对Retina屏幕使用@2x的图像,来区别普通屏幕下的显示,那么使用下面的Media Queries会让你很轻松实现。

Retina iPad (portrait 和 landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 2) {
/* 样式写在这里 */
}

Retina iPad (landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 2) {
/* 样式写在这里 */
}

Retina iPad (portrait)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 2) {
/* 样式写在这里 */
}

3、iPad 1 和 iPad 2 Media Queries

上面的满足了高版本,可能你对细节追求的比较高,想让你的Web在低版本的iPad下也能展示的很完美,那么下面的这几段代码能帮助你。

iPad 1 有 iPad 2 (portrait 和landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1){
/* 样式写在这里 */
}

iPad 1 有 iPad 2 (landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) {
/* 样式写在这里 */
}

iPad 1 有 iPad 2 (portrait)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) {
/* 样式写在这里 */
}

iPad mini Media Queries

使用Media Queries还能帮助我们区分iPad和iPad mini,具体的看下面的代码

iPad mini (portrait 和 landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1) {
/* 样式写在这里 */
}

iPad mini (landscape)

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) {
/* 样式写在这里 */
}

iPad mini Resolution

@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) {
/* 样式写在这里 */
}

iPad mini (portrait)

Screen Width = 768px (CSS Pixels)
Screen Height = 1024px (CSS Pixels) Screen Width = 768px (Actual Pixels)
Screen Height = 1024px (Actual Pixels) Device-pixel-ratio: 1

iPhone Media Queries

1、iPhone 5 Media Queries

iPhone 5 (portrait 和 landscape)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px) {
/* 样式写在这里 */
}

iPhone 5 (landscape)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : landscape) {
/* 样式写在这里 */
}

iPhone 5 (portrait)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : portrait) {
/* 样式写在这里 */
}

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

iPhone 2G-4S (portrait 和 landscape)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* 样式写在这里 */
}

iPhone 2G-4S (landscape)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px)
and (orientation : landscape) {
/* 样式写这里 */
}

iPhone 2G-4S (portrait)

@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px)
and (orientation : portrait) {
/* 样式写这里 */
}

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

上面Media Queries主要是针对于苹果中的iPad和iPhone设备,而且使用的是px为计算单位,大家也可以将上面的px代码转换成em,详细的可以看看使用em单位创建CSS3的Media Queries

更新:iPhone6

@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) {
/*iPhone 6 Portrait*/
} @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) {
/*iPhone 6 landscape*/
} @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) {
/*iPhone 6+ Portrait*/
} @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) {
/*iPhone 6+ landscape*/
} @media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px){
/*iPhone 6 and iPhone 6+ portrait and landscape*/
} @media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : portrait){
/*iPhone 6 and iPhone 6+ portrait*/
} @media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : landscape){
/*iPhone 6 and iPhone 6+ landscape*/
}

特别声明:本文中展示的代码是由@stephentgilbert搜集与整理,详细可以点击CSS Media Queries for iPads & iPhones

如需转载,烦请注明出处:http://www.w3cplus.com/css3/css-media-queries-for-iPads-and-iPhones.html

iPads和iPhones的Media Queries的更多相关文章

  1. CSS3 媒体查询移动设备尺寸 Media Queries for Standard Devices (包括 苹果手表 apple watch)

    /* ----------- iPhone 4 and 4S ----------- */ /* Portrait and Landscape */ @media only screen and (m ...

  2. CSS3 Media Queries 片段

    CSS3 Media Queries片段 在这里主要分成三类:移动端.PC端以及一些常见的响应式框架的Media Queries片段. 移动端Media Queries片段 iPhone5 @medi ...

  3. CSS3 Media Queries模板

    使用max-width @media screen and (max-width: 600px) { //你的样式放在这里.... } 使用min-width @media screen and (m ...

  4. CSS3 Media Queries模板:max-width和min-width

    CSS3 Media Queries模板 CSS3 Media Queries一般都是使用“max-width”和“min-width”两个属性来检查各种设备的分辨大小与样式表所设条件是否满足,如果满 ...

  5. 实践 HTML5 的 CSS3 Media Queries

    先来介绍下 media,确切的说应该是 CSS media queries(CSS 媒体查询),媒体查询包含了一个媒体类型和至少一个使用如宽度.高度和颜色等媒体属性来限制样式表范围的表达式.CSS3 ...

  6. CSS3 Media Queries 实现响应式设计

    在 CSS2 中,你可以为不同的媒介设备(如屏幕.打印机)指定专用的样式表,而现在借助 CSS3 的 Media Queries 特性,可以更为有效的实现这个功能.你可以为媒介类型添加某些条件,检测设 ...

  7. 使用CSS3 Media Queries实现网页自适应

    原文来源:http://webdesignerwall.com 翻译:http://xinyo.org 当今银屏分辨率从 320px (iPhone)到 2560px (大屏显示器)或者更大.人们也不 ...

  8. Media Queries 详解

    Media Queries直译过来就是“媒体查询”,在我们平时的Web页面中head部分常看到这样的一段代码:  <link href="css/reset.css" rel ...

  9. Media Queries使用方法

    1. 最大宽度max-width “max-width”是媒体特性中最常用的一个特性,其意思是指媒体类型小于或等于指定的宽度时,样式生效.如: @media screen and (max-width ...

随机推荐

  1. HDU 1023 Traning Problem (2) 高精度卡特兰数

    Train Problem II Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Sub ...

  2. July 22nd, Week 30th Friday, 2016

    Love means never having to say you are sorry. 爱就是永远不必说对不起. Love means knowing each other deeply, the ...

  3. July 18th, Week 30th Monday, 2016

    Truth needs no color; beauty, no pencil. 真理不需要色彩,美丽无需涂饰. Most of the time, giving some color to trut ...

  4. Babelfish(poj 2503)

    大致题意: 输入一个字典,字典格式为“英语à外语”的一一映射关系 然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh” #include<iostream& ...

  5. charles使用教程指南(抓包工具)

    0x01 前言: Charles是一款抓包修改工具,相比起burp,charles具有界面简单直观,易于上手,数据请求控制容易,修改简单,抓取数据的开始暂停方便等等优势!下面来详细介绍下这款强大好用的 ...

  6. PHP生成不重复随机数的方法

    无论是Web应用,还是WAP或者移动应用,随机数都有其用武之地.在最近接触的几个小项目中,我也经常需要和随机数或者随机数组打交道,所以,对于PHP如何产生不重复随机数常用的几种方法小结一下. 方法一: ...

  7. BEGIN TRAN...COMMIT TRAN 意思与用法

    BEGIN TRAN标记事务开始 COMMIT TRAN 提交事务 一般把DML语句(select ,delete,update,insert语句)放在BEGIN TRAN...COMMIT TRAN ...

  8. windows脚本定时执行

    linux下可以直接用cron定时任务,window下可以使用schtasks 命令代替. 第一次在win7 cmd输入: schtasks 如果出现错误:“错误:无法加载列表资源” 的问题原因很简单 ...

  9. A jubeat

    Time Limit:1000MS  Memory Limit:65535K 题型: 编程题   语言: 无限制 描述 jubeat是一款由日本KONAMI倾心打造的体感音乐游戏,该作在日韩.香港等地 ...

  10. 最大子矩阵和 URAL 1146 Maximum Sum

    题目传送门 /* 最大子矩阵和:把二维降到一维,即把列压缩:然后看是否满足最大连续子序列: 好像之前做过,没印象了,看来做过的题目要经常看看:) */ #include <cstdio> ...