SlideShare a Scribd company logo
1 of 11
Download to read offline
Koubei F2E 善朋
  2010.04.20
iPhone 3G S
爱上iPhone 3G的理由

功能创新的电话
通过 iPhone 上的 Multi-Touch 用户界面,你在通讯录、个人收藏、通话记录或
者其他几乎任何地方中轻点名字或号码就可以直接进行拨号。


宽屏 iPod
配备 3.5 英寸亮丽的显示屏,iPhone 上的内容 ─ 包括音乐、照片和视频等将
显得更加出色。手指轻扫即可浏览歌曲和播放列表,使用 Cover Flow 欣赏你
的专辑封面。


突破性的上网装置
通过高速 3G 网络,iPhone 支持 HTML 邮件和先进的 Safari 网络浏览器,并
内置搜索功能,为你带来移动装置上前所未有的互联网体验。iPhone 擅长
多任务操作,你能够一边打电话,一边发送邮件或者上网。


方向感应器,Multi-Touch,智能键盘和中文输入。。。
border-radius
 background-origin
 background-clip
 text-shadow
 box-shadow
 first-child
 last-child
  ……




Happy Ending…
iPhone手机网站开发总结
1. HTML的head标签内需要显示声明meta属性:<meta name=”viewport”
content=”width=device-width; minimum-scale=1.0; maximum-scale=1″ />,minimum-
scale和maximum-scale主要作用是控制内容的显示比例。

2. 在使用css3的时候,要通过-khtml为前缀的方式,-webkit的方式不管用。比如:
-khtml-border-radius。

3. 对css的inline-block支持不是很良好。

4. 没有:hover状态,不过可以通过iphone的ontouchstart和ontouchend两个独有的
事件来模拟触屏特效。

5. 在横屏和竖屏的情况下,字体会发生变化。这可以通过在html中用css的属性:
-webkit-text-size- adjust:none;

6. 支持大多数的css3属性:我使用到的就有:last-child,:first-child,nth-child(n),:last-
of- type,:first-of-type等等,通过只用这些css属性,可是节省很多麻烦。

7. iphone同时也好支持几个class类做判断的功能。


                           iPhone网站开发点滴
iPhone 3G S

                CSS

              Javascript

                HTML
CSS
“The practical upshot of this is that you need to do no cross-browser
testing, and can use all the CSS3 you like. “

1. <link rel="stylesheet" type="text/css" href=“iphone.css” />

2. @media screen and (max-device-width: 480px){ /*--- iPhone only ---*/ }

3. -webkit-text-size-adjust 用于控制在横竖频切换的时候字体是否改变

4. 支持大部分的CSS3新特性,不过对于一些特效要使用-khtml前缀(比如:border-radius,
   background-origin等等)
Javascript
侦测iPhone/iPod
Touch Events
Gestures
即是指两只手指接触屏幕的时候缩放或者旋转的效果,对于侦听gestures,iPhone也有三个
if((navigator.userAgent.match(/iPhone/i)) ||(navigator.userAgent.match(/iPad/i))) {
iPhone是使用触屏的方式,所以就需要有手触屏和离开的时候的事件机制,幸好,iPhone做
好了这方面的工作,提供了四个处理touch的事件:touchstart,touchend,touchmove,
事件:gesturestart,gestureend,gesturechange。
    if (document.cookie.indexOf("iphone_redirect=false") == -1) {
同时事件参数event有两个属性:scale,rotate。Scale的中间值是1,大于1表示放大,小于1
      window.location = “http://www.example.com/iphone/";
touchcancel (when the system cancels the touch)
表示缩小。
    }
}

侦测设备旋转方向
iPhone可以在横屏状态下浏览网页,有时候你会想知道用户设备的手持状态来增强可用性和
功能。
iPhone/iPad中都有一个window.orientation的属性来判断在页面onload的时候设备向哪个方向
旋转。
HTML
viewport的声明的作用:tells Safari that the viewport should be the same size
CSS3媒体查询
<html>
as the iPhone screen。
对于CSS3的媒体(media)查询,iPhone和iPad是不同的。通过这个技术,可以对设备
<head>
不同的握持方向应用不同的样式,增强功能和体验。
   <title>iPhone 3G S</title>
1. <meta name="viewport" content="width=780" />
   <meta name="viewport" content="width=device-width; initial-
2. <meta name="viewport" content="width=device-width,initial-scale=1,
iPhone是通过屏幕最大宽度来侦测的。是这样:
scale=1.0; maximum-scale=1.0;">
   user-scalable=no" />
<link rel="stylesheet" media="screen and (max-width: 320px)" href="portrait.css" />
3.<link … name="viewport" content="height=device-height,width=device-width" />
   <meta />
<link rel="stylesheet" media="screen and (min-width: 321px)" href="landscape.css" />
</head>
<body> Links
 Special
而iPad有点不同,它直接使用了媒体查询中的orientation属性。是这样:
<!-- content here -- >
<a href="tel:12345678900">Call me</a> (orientation:portrait)" href="portrait.css" />
<link rel="stylesheet" media="screen and
<a href="sms:12345678900">Send me a text</a>
</body>
<link rel="stylesheet" media="screen and (orientation:landscape)" href="landscape.css" />
</html>
之后只要将不同的样式分别定义出来就可以了。
The Home Icon
<link rel="apple-touch-icon" href="http://www.example.com/my-filename.png" />
Resource List:
Tutorial: Building a website for the iPhone
iPhone Development: 12 Tips To Get You Started
10条小代码开发 iPhone友好的网站
iPhone CSS—tips for building iPhone websites
CSS3 Previews
iPad的CSS3媒体查询
iPhone网站开发点滴
Thanks!!

More Related Content

Viewers also liked

夜宴28期《Revolution》
夜宴28期《Revolution》夜宴28期《Revolution》
夜宴28期《Revolution》Koubei Banquet
 
夜宴53期《Tail of 2010 》
夜宴53期《Tail of 2010 》夜宴53期《Tail of 2010 》
夜宴53期《Tail of 2010 》Koubei Banquet
 
夜宴42期《Gadgets》
夜宴42期《Gadgets》夜宴42期《Gadgets》
夜宴42期《Gadgets》Koubei Banquet
 
夜宴18期《旧的不去新的不来》
夜宴18期《旧的不去新的不来》夜宴18期《旧的不去新的不来》
夜宴18期《旧的不去新的不来》Koubei Banquet
 
夜宴6期《Past, Present, and Future》
夜宴6期《Past, Present, and Future》夜宴6期《Past, Present, and Future》
夜宴6期《Past, Present, and Future》Koubei Banquet
 
夜宴26期《Mobile Web测试》
夜宴26期《Mobile Web测试》夜宴26期《Mobile Web测试》
夜宴26期《Mobile Web测试》Koubei Banquet
 
夜宴33期《未来是湿的》
夜宴33期《未来是湿的》夜宴33期《未来是湿的》
夜宴33期《未来是湿的》Koubei Banquet
 
夜宴41期《新事》
夜宴41期《新事》夜宴41期《新事》
夜宴41期《新事》Koubei Banquet
 
夜宴24期《这段时间》
夜宴24期《这段时间》夜宴24期《这段时间》
夜宴24期《这段时间》Koubei Banquet
 
夜宴49期《YUI Conf 2010》
夜宴49期《YUI Conf 2010》夜宴49期《YUI Conf 2010》
夜宴49期《YUI Conf 2010》Koubei Banquet
 
夜宴8期《Dive into Mozilla Labs》
夜宴8期《Dive into Mozilla Labs》夜宴8期《Dive into Mozilla Labs》
夜宴8期《Dive into Mozilla Labs》Koubei Banquet
 
夜宴36期《技术前哨站》
夜宴36期《技术前哨站》夜宴36期《技术前哨站》
夜宴36期《技术前哨站》Koubei Banquet
 
夜宴38期《侵权 & 山寨》
夜宴38期《侵权 & 山寨》夜宴38期《侵权 & 山寨》
夜宴38期《侵权 & 山寨》Koubei Banquet
 
夜宴29期《难兄难弟》
夜宴29期《难兄难弟》夜宴29期《难兄难弟》
夜宴29期《难兄难弟》Koubei Banquet
 
夜宴1期《我们可以做的更好》
夜宴1期《我们可以做的更好》夜宴1期《我们可以做的更好》
夜宴1期《我们可以做的更好》Koubei Banquet
 
夜宴45期《Sociability is complex》
夜宴45期《Sociability is complex》夜宴45期《Sociability is complex》
夜宴45期《Sociability is complex》Koubei Banquet
 
夜宴20期《Google退出“中国”?》
夜宴20期《Google退出“中国”?》夜宴20期《Google退出“中国”?》
夜宴20期《Google退出“中国”?》Koubei Banquet
 
夜宴35期《质量?》
夜宴35期《质量?》夜宴35期《质量?》
夜宴35期《质量?》Koubei Banquet
 

Viewers also liked (20)

夜宴28期《Revolution》
夜宴28期《Revolution》夜宴28期《Revolution》
夜宴28期《Revolution》
 
夜宴53期《Tail of 2010 》
夜宴53期《Tail of 2010 》夜宴53期《Tail of 2010 》
夜宴53期《Tail of 2010 》
 
夜宴42期《Gadgets》
夜宴42期《Gadgets》夜宴42期《Gadgets》
夜宴42期《Gadgets》
 
夜宴18期《旧的不去新的不来》
夜宴18期《旧的不去新的不来》夜宴18期《旧的不去新的不来》
夜宴18期《旧的不去新的不来》
 
夜宴6期《Past, Present, and Future》
夜宴6期《Past, Present, and Future》夜宴6期《Past, Present, and Future》
夜宴6期《Past, Present, and Future》
 
夜宴26期《Mobile Web测试》
夜宴26期《Mobile Web测试》夜宴26期《Mobile Web测试》
夜宴26期《Mobile Web测试》
 
夜宴33期《未来是湿的》
夜宴33期《未来是湿的》夜宴33期《未来是湿的》
夜宴33期《未来是湿的》
 
夜宴41期《新事》
夜宴41期《新事》夜宴41期《新事》
夜宴41期《新事》
 
夜宴24期《这段时间》
夜宴24期《这段时间》夜宴24期《这段时间》
夜宴24期《这段时间》
 
夜宴49期《YUI Conf 2010》
夜宴49期《YUI Conf 2010》夜宴49期《YUI Conf 2010》
夜宴49期《YUI Conf 2010》
 
夜宴8期《Dive into Mozilla Labs》
夜宴8期《Dive into Mozilla Labs》夜宴8期《Dive into Mozilla Labs》
夜宴8期《Dive into Mozilla Labs》
 
夜宴36期《技术前哨站》
夜宴36期《技术前哨站》夜宴36期《技术前哨站》
夜宴36期《技术前哨站》
 
夜宴38期《侵权 & 山寨》
夜宴38期《侵权 & 山寨》夜宴38期《侵权 & 山寨》
夜宴38期《侵权 & 山寨》
 
夜宴29期《难兄难弟》
夜宴29期《难兄难弟》夜宴29期《难兄难弟》
夜宴29期《难兄难弟》
 
夜宴1期《我们可以做的更好》
夜宴1期《我们可以做的更好》夜宴1期《我们可以做的更好》
夜宴1期《我们可以做的更好》
 
夜宴45期《Sociability is complex》
夜宴45期《Sociability is complex》夜宴45期《Sociability is complex》
夜宴45期《Sociability is complex》
 
夜宴20期《Google退出“中国”?》
夜宴20期《Google退出“中国”?》夜宴20期《Google退出“中国”?》
夜宴20期《Google退出“中国”?》
 
Virtues of Koran
Virtues of KoranVirtues of Koran
Virtues of Koran
 
Ihya v2
Ihya v2Ihya v2
Ihya v2
 
夜宴35期《质量?》
夜宴35期《质量?》夜宴35期《质量?》
夜宴35期《质量?》
 

Similar to 夜宴23期《iPhone 3GS》

Iphone application developement seminar
Iphone application developement seminarIphone application developement seminar
Iphone application developement seminarNiraj Narkhede
 
iphone and samrt phone
iphone and samrt phoneiphone and samrt phone
iphone and samrt phonekhawla Osama
 
Introduction to Progamming Applications for the iPhone
Introduction to Progamming Applications for the iPhoneIntroduction to Progamming Applications for the iPhone
Introduction to Progamming Applications for the iPhonerohitnayak
 
Iphone Application Development
Iphone Application DevelopmentIphone Application Development
Iphone Application DevelopmentYn Reddy
 
Iphone
IphoneIphone
Iphoneoohh
 
Developing smartphones
Developing smartphonesDeveloping smartphones
Developing smartphonesThisura Indula
 
Apple i phone newtrent.com
Apple i phone  newtrent.comApple i phone  newtrent.com
Apple i phone newtrent.comKala Seo
 
inphone
inphoneinphone
inphonereeece
 
The Iphone
The IphoneThe Iphone
The Iphonejonang20
 
Apple iOS Introduction
Apple iOS IntroductionApple iOS Introduction
Apple iOS IntroductionPratik Vyas
 
The iphone-guide
The iphone-guideThe iphone-guide
The iphone-guidedignacio
 
1572143634865065972041229-140802014601-phpapp01 (1).pptx
1572143634865065972041229-140802014601-phpapp01 (1).pptx1572143634865065972041229-140802014601-phpapp01 (1).pptx
1572143634865065972041229-140802014601-phpapp01 (1).pptxDeepakPanchal65
 
iPhone Seminar Part 1
iPhone Seminar Part  1iPhone Seminar Part  1
iPhone Seminar Part 1NAILBITER
 

Similar to 夜宴23期《iPhone 3GS》 (20)

Iphone
IphoneIphone
Iphone
 
Iphone application developement seminar
Iphone application developement seminarIphone application developement seminar
Iphone application developement seminar
 
Week14
Week14Week14
Week14
 
iphone and samrt phone
iphone and samrt phoneiphone and samrt phone
iphone and samrt phone
 
iphone
iphoneiphone
iphone
 
Introduction to Progamming Applications for the iPhone
Introduction to Progamming Applications for the iPhoneIntroduction to Progamming Applications for the iPhone
Introduction to Progamming Applications for the iPhone
 
Iphone Application Development
Iphone Application DevelopmentIphone Application Development
Iphone Application Development
 
Iphone
IphoneIphone
Iphone
 
Developing smartphones
Developing smartphonesDeveloping smartphones
Developing smartphones
 
Apple i phone newtrent.com
Apple i phone  newtrent.comApple i phone  newtrent.com
Apple i phone newtrent.com
 
Apple Iphone 5
Apple Iphone 5Apple Iphone 5
Apple Iphone 5
 
inphone
inphoneinphone
inphone
 
The Iphone
The IphoneThe Iphone
The Iphone
 
IOS7
IOS7IOS7
IOS7
 
Apple iOS Introduction
Apple iOS IntroductionApple iOS Introduction
Apple iOS Introduction
 
The iphone-guide
The iphone-guideThe iphone-guide
The iphone-guide
 
20100831 igelu mobilise_ugent
20100831 igelu mobilise_ugent20100831 igelu mobilise_ugent
20100831 igelu mobilise_ugent
 
1572143634865065972041229-140802014601-phpapp01 (1).pptx
1572143634865065972041229-140802014601-phpapp01 (1).pptx1572143634865065972041229-140802014601-phpapp01 (1).pptx
1572143634865065972041229-140802014601-phpapp01 (1).pptx
 
iPhone Seminar Part 1
iPhone Seminar Part  1iPhone Seminar Part  1
iPhone Seminar Part 1
 
iPhone And Its Features
iPhone And Its FeaturesiPhone And Its Features
iPhone And Its Features
 

More from Koubei Banquet

夜宴2期《ActionScript与JavaScript》
夜宴2期《ActionScript与JavaScript》夜宴2期《ActionScript与JavaScript》
夜宴2期《ActionScript与JavaScript》Koubei Banquet
 
夜宴54期《我的关注》
夜宴54期《我的关注》夜宴54期《我的关注》
夜宴54期《我的关注》Koubei Banquet
 
夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》Koubei Banquet
 
夜宴50期《YUI3 editor》
夜宴50期《YUI3 editor》夜宴50期《YUI3 editor》
夜宴50期《YUI3 editor》Koubei Banquet
 
夜宴48期《一场关于YUI3/jQuery的精彩辩论》
夜宴48期《一场关于YUI3/jQuery的精彩辩论》夜宴48期《一场关于YUI3/jQuery的精彩辩论》
夜宴48期《一场关于YUI3/jQuery的精彩辩论》Koubei Banquet
 
夜宴47期《一个艰难的决定》
夜宴47期《一个艰难的决定》夜宴47期《一个艰难的决定》
夜宴47期《一个艰难的决定》Koubei Banquet
 
夜宴44期《我们蛋疼的年代——安全篇》
夜宴44期《我们蛋疼的年代——安全篇》夜宴44期《我们蛋疼的年代——安全篇》
夜宴44期《我们蛋疼的年代——安全篇》Koubei Banquet
 
夜宴43期《Auto Tools》
夜宴43期《Auto Tools》夜宴43期《Auto Tools》
夜宴43期《Auto Tools》Koubei Banquet
 
夜宴40期《表单-反馈-体验》
夜宴40期《表单-反馈-体验》夜宴40期《表单-反馈-体验》
夜宴40期《表单-反馈-体验》Koubei Banquet
 
夜宴39期《Seven》
夜宴39期《Seven》夜宴39期《Seven》
夜宴39期《Seven》Koubei Banquet
 
夜宴37期《专利》
夜宴37期《专利》夜宴37期《专利》
夜宴37期《专利》Koubei Banquet
 
夜宴32期《WordPress and so on》
夜宴32期《WordPress and so on》夜宴32期《WordPress and so on》
夜宴32期《WordPress and so on》Koubei Banquet
 
夜宴31期《浏览器》
夜宴31期《浏览器》夜宴31期《浏览器》
夜宴31期《浏览器》Koubei Banquet
 
夜宴30期《HTML5 is coming》
夜宴30期《HTML5 is coming》夜宴30期《HTML5 is coming》
夜宴30期《HTML5 is coming》Koubei Banquet
 
夜宴25期《Web的未来》
夜宴25期《Web的未来》夜宴25期《Web的未来》
夜宴25期《Web的未来》Koubei Banquet
 
夜宴21期《Adobe CS5 & Color》
夜宴21期《Adobe CS5 & Color》夜宴21期《Adobe CS5 & Color》
夜宴21期《Adobe CS5 & Color》Koubei Banquet
 

More from Koubei Banquet (17)

夜宴2期《ActionScript与JavaScript》
夜宴2期《ActionScript与JavaScript》夜宴2期《ActionScript与JavaScript》
夜宴2期《ActionScript与JavaScript》
 
夜宴54期《我的关注》
夜宴54期《我的关注》夜宴54期《我的关注》
夜宴54期《我的关注》
 
夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》
 
夜宴50期《YUI3 editor》
夜宴50期《YUI3 editor》夜宴50期《YUI3 editor》
夜宴50期《YUI3 editor》
 
夜宴48期《一场关于YUI3/jQuery的精彩辩论》
夜宴48期《一场关于YUI3/jQuery的精彩辩论》夜宴48期《一场关于YUI3/jQuery的精彩辩论》
夜宴48期《一场关于YUI3/jQuery的精彩辩论》
 
夜宴47期《一个艰难的决定》
夜宴47期《一个艰难的决定》夜宴47期《一个艰难的决定》
夜宴47期《一个艰难的决定》
 
夜宴44期《我们蛋疼的年代——安全篇》
夜宴44期《我们蛋疼的年代——安全篇》夜宴44期《我们蛋疼的年代——安全篇》
夜宴44期《我们蛋疼的年代——安全篇》
 
夜宴43期《Auto Tools》
夜宴43期《Auto Tools》夜宴43期《Auto Tools》
夜宴43期《Auto Tools》
 
夜宴40期《表单-反馈-体验》
夜宴40期《表单-反馈-体验》夜宴40期《表单-反馈-体验》
夜宴40期《表单-反馈-体验》
 
夜宴39期《Seven》
夜宴39期《Seven》夜宴39期《Seven》
夜宴39期《Seven》
 
夜宴37期《专利》
夜宴37期《专利》夜宴37期《专利》
夜宴37期《专利》
 
夜宴32期《WordPress and so on》
夜宴32期《WordPress and so on》夜宴32期《WordPress and so on》
夜宴32期《WordPress and so on》
 
夜宴31期《浏览器》
夜宴31期《浏览器》夜宴31期《浏览器》
夜宴31期《浏览器》
 
夜宴30期《HTML5 is coming》
夜宴30期《HTML5 is coming》夜宴30期《HTML5 is coming》
夜宴30期《HTML5 is coming》
 
Banquet 27
Banquet 27Banquet 27
Banquet 27
 
夜宴25期《Web的未来》
夜宴25期《Web的未来》夜宴25期《Web的未来》
夜宴25期《Web的未来》
 
夜宴21期《Adobe CS5 & Color》
夜宴21期《Adobe CS5 & Color》夜宴21期《Adobe CS5 & Color》
夜宴21期《Adobe CS5 & Color》
 

夜宴23期《iPhone 3GS》

  • 1. Koubei F2E 善朋 2010.04.20
  • 3. 爱上iPhone 3G的理由 功能创新的电话 通过 iPhone 上的 Multi-Touch 用户界面,你在通讯录、个人收藏、通话记录或 者其他几乎任何地方中轻点名字或号码就可以直接进行拨号。 宽屏 iPod 配备 3.5 英寸亮丽的显示屏,iPhone 上的内容 ─ 包括音乐、照片和视频等将 显得更加出色。手指轻扫即可浏览歌曲和播放列表,使用 Cover Flow 欣赏你 的专辑封面。 突破性的上网装置 通过高速 3G 网络,iPhone 支持 HTML 邮件和先进的 Safari 网络浏览器,并 内置搜索功能,为你带来移动装置上前所未有的互联网体验。iPhone 擅长 多任务操作,你能够一边打电话,一边发送邮件或者上网。 方向感应器,Multi-Touch,智能键盘和中文输入。。。
  • 4. border-radius background-origin background-clip text-shadow box-shadow first-child last-child …… Happy Ending…
  • 5. iPhone手机网站开发总结 1. HTML的head标签内需要显示声明meta属性:<meta name=”viewport” content=”width=device-width; minimum-scale=1.0; maximum-scale=1″ />,minimum- scale和maximum-scale主要作用是控制内容的显示比例。 2. 在使用css3的时候,要通过-khtml为前缀的方式,-webkit的方式不管用。比如: -khtml-border-radius。 3. 对css的inline-block支持不是很良好。 4. 没有:hover状态,不过可以通过iphone的ontouchstart和ontouchend两个独有的 事件来模拟触屏特效。 5. 在横屏和竖屏的情况下,字体会发生变化。这可以通过在html中用css的属性: -webkit-text-size- adjust:none; 6. 支持大多数的css3属性:我使用到的就有:last-child,:first-child,nth-child(n),:last- of- type,:first-of-type等等,通过只用这些css属性,可是节省很多麻烦。 7. iphone同时也好支持几个class类做判断的功能。 iPhone网站开发点滴
  • 6. iPhone 3G S CSS Javascript HTML
  • 7. CSS “The practical upshot of this is that you need to do no cross-browser testing, and can use all the CSS3 you like. “ 1. <link rel="stylesheet" type="text/css" href=“iphone.css” /> 2. @media screen and (max-device-width: 480px){ /*--- iPhone only ---*/ } 3. -webkit-text-size-adjust 用于控制在横竖频切换的时候字体是否改变 4. 支持大部分的CSS3新特性,不过对于一些特效要使用-khtml前缀(比如:border-radius, background-origin等等)
  • 8. Javascript 侦测iPhone/iPod Touch Events Gestures 即是指两只手指接触屏幕的时候缩放或者旋转的效果,对于侦听gestures,iPhone也有三个 if((navigator.userAgent.match(/iPhone/i)) ||(navigator.userAgent.match(/iPad/i))) { iPhone是使用触屏的方式,所以就需要有手触屏和离开的时候的事件机制,幸好,iPhone做 好了这方面的工作,提供了四个处理touch的事件:touchstart,touchend,touchmove, 事件:gesturestart,gestureend,gesturechange。 if (document.cookie.indexOf("iphone_redirect=false") == -1) { 同时事件参数event有两个属性:scale,rotate。Scale的中间值是1,大于1表示放大,小于1 window.location = “http://www.example.com/iphone/"; touchcancel (when the system cancels the touch) 表示缩小。 } } 侦测设备旋转方向 iPhone可以在横屏状态下浏览网页,有时候你会想知道用户设备的手持状态来增强可用性和 功能。 iPhone/iPad中都有一个window.orientation的属性来判断在页面onload的时候设备向哪个方向 旋转。
  • 9. HTML viewport的声明的作用:tells Safari that the viewport should be the same size CSS3媒体查询 <html> as the iPhone screen。 对于CSS3的媒体(media)查询,iPhone和iPad是不同的。通过这个技术,可以对设备 <head> 不同的握持方向应用不同的样式,增强功能和体验。 <title>iPhone 3G S</title> 1. <meta name="viewport" content="width=780" /> <meta name="viewport" content="width=device-width; initial- 2. <meta name="viewport" content="width=device-width,initial-scale=1, iPhone是通过屏幕最大宽度来侦测的。是这样: scale=1.0; maximum-scale=1.0;"> user-scalable=no" /> <link rel="stylesheet" media="screen and (max-width: 320px)" href="portrait.css" /> 3.<link … name="viewport" content="height=device-height,width=device-width" /> <meta /> <link rel="stylesheet" media="screen and (min-width: 321px)" href="landscape.css" /> </head> <body> Links Special 而iPad有点不同,它直接使用了媒体查询中的orientation属性。是这样: <!-- content here -- > <a href="tel:12345678900">Call me</a> (orientation:portrait)" href="portrait.css" /> <link rel="stylesheet" media="screen and <a href="sms:12345678900">Send me a text</a> </body> <link rel="stylesheet" media="screen and (orientation:landscape)" href="landscape.css" /> </html> 之后只要将不同的样式分别定义出来就可以了。 The Home Icon <link rel="apple-touch-icon" href="http://www.example.com/my-filename.png" />
  • 10. Resource List: Tutorial: Building a website for the iPhone iPhone Development: 12 Tips To Get You Started 10条小代码开发 iPhone友好的网站 iPhone CSS—tips for building iPhone websites CSS3 Previews iPad的CSS3媒体查询 iPhone网站开发点滴