<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>前端观察 &#187; Front News</title>
	<atom:link href="http://www.qianduan.net/category/news-of-designs/feed" rel="self" type="application/rss+xml" />
	<link>http://www.qianduan.net</link>
	<description>专注于网站前端设计与前端开发</description>
	<lastBuildDate>Wed, 08 Feb 2012 05:05:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Chrome for Android发布</title>
		<link>http://www.qianduan.net/the-chrome-for-the-the-the-android-release-of-the.html</link>
		<comments>http://www.qianduan.net/the-chrome-for-the-the-the-android-release-of-the.html#comments</comments>
		<pubDate>Wed, 08 Feb 2012 03:24:55 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Chrome]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12970</guid>
		<description><![CDATA[前些天传言的chrome团队将开发android版本的消息，终于得到证实了。我们还是最关注这个版本的浏览器对前端开发的影响，让我们看一下它现在的技术支持情况吧... ]]></description>
			<content:encoded><![CDATA[<p>前些天传言的chrome团队将开发android版本的消息，今天已经发布了，Google的效率真高啊。当然我们还是最关注这个版本的浏览器对前端开发的影响，让我们看一下它现在的技术支持情况吧。<span id="more-12970"></span></p>
<p>Chrome for Android的部分特性：</p>
<ul>
<li>支持CSS 3D transform</li>
<li>支持CSS3 动画(animation)</li>
<li>支持SVG</li>
<li>支持WebSockets</li>
<li>支持专用web worker</li>
<li>支持HTML5表单的时间选择器</li>
<li>支持HTML 媒体捕获API (<a title="w3c media capture APIs" href="http://www.w3.org/TR/2010/WD-html-media-capture-20100928/" target="_blank">media capture APIs</a>)</li>
<li>支持IndexedDB</li>
<li>支持离线缓存（Aapplication Cache）</li>
<li>支持File APIs</li>
<li>支持Geolocation</li>
<li>支持<strong>position:fixed和overflow:scroll</strong></li>
<li>支持canvas的GPU加速</li>
<li>支持omnibox</li>
<li><strong>不支持</strong>Flash插件（adobe也自己放弃移动版本的开发了）</li>
<li>不支持sandbox</li>
<li>暂不支持扩展</li>
</ul>
<p>可以看到，桌面端的特性，这个版本也大部分都支持了，当然移动终端有自己的特性和硬件限制，所以体验和功能上也一定不尽相同。</p>
<p>想要吐槽的是，Flash真是耗电大户啊，笔记本只上网或coding的话，电池用9个小时没问题，玩网页游戏竟然只够玩1个多小时，比看电影玩网游都耗电啊。。。</p>
<p>PS:目前chrome for andriod只是beta版本，将来可以像桌面版那样分dev、beta、stable版本演进，支持market自动升级。可是，好过粪的是，Google竟然学起了微软了啊，只支持ICS(android 4.0)版本，让我这等买不起支持ICS设备+手上的机器不支持升级到ICS的人情何以堪啊。。。</p>
<p>Update:目前国内的帐号无法从android market中安装，需要安装的话需要费点儿周折：</p>
<ol>
<li>进入飞行模式。</li>
<li>打开 Wifi 及连上位于 USA 的 VPN。</li>
<li>在 Android Market 中安装 <a title="chrome for android" href="https://market.android.com/details?id=com.android.chrome" target="_blank">Chrome for Android</a> 。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/the-chrome-for-the-the-the-android-release-of-the.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mozilla Boot to Gecko简介和展望</title>
		<link>http://www.qianduan.net/on-mozilla-boot-to-geckos-profile-and-expectations.html</link>
		<comments>http://www.qianduan.net/on-mozilla-boot-to-geckos-profile-and-expectations.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 10:22:30 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[b2g]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12957</guid>
		<description><![CDATA[1月7日，Mozilla中国去的工程师在深圳腾讯大厦举办了Firefox新版本体验活动，其中一个话题是关于Mozilla Boot to Gecko项目的，之前我也只是简单的听说，没有深入了解，听了来自台湾的James的分享... ]]></description>
			<content:encoded><![CDATA[<p>1月7日，Mozilla中国去的工程师在深圳腾讯大厦举办了Firefox新版本体验活动，其中一个话题是关于Mozilla Boot to Gecko项目的，之前我也只是简单的听说，没有深入了解，听了来自台湾的James的分享之后，感觉是，好期待啊！<span id="more-12957"></span></p>
<p>因为这还是个进行中的项目，实际的资料也不是很多，我这里也只是简单的介绍下，详细的内容等今年Q1或者Q2吧，预计到时候会有实质性的进展。</p>
<h3>简介：</h3>
<ul>
<li>设备启动后直接进入浏览器(Firefox的内核Gecko)</li>
<li>完全支持HTML5</li>
<li>基于Android底层，嗯，Linux 内核+驱动层，仅此而已</li>
<li>UI和所有功能都用Gecko实现</li>
<li>也就是说，浏览器可以完全访问和控制设备的硬件！</li>
<li>基于上一点，Mozilla在和<a title="w3c device api working group" href="http://www.w3.org/2009/dap/">W3C device APIs工作组</a>编写一些需要用到的api，比如：电池状态、短信、联系人、电话、媒体捕获(摄像头、话筒等)、网络信息、处理器、各种传感器等。</li>
</ul>
<p>也就是说，B2G是一个基于浏览器的操作系统，你可以在它上面打电话、发短信、视频聊天、玩各种游戏，而这些功能，都是用HTML5来实现的。。。</p>
<p>显然，这是一个类似Chrome OS的项目，只是B2G针对移动终端，而Chrome OS目前还只是在上网本。。。</p>
<h3>展望：</h3>
<p>是的，最关键的是W3C的各种Device APIs，它们是B2G的基础，但是，也可能会让B2G死掉，因为，后面很容易就会有Boot to Webkit、Boot to Trident、Boot to Presto，甚至会有Boot to QQ。。。真的这样的话，Mozilla就又成<del datetime="2012-01-13T19:00:59+00:00">先驱</del>先烈了，悲催～～</p>
<p>当然，即便没有这些 Boot to xxx，我们也可以在移动终端的浏览器中实现所有B2G中的功能，你可以在浏览器里面打开Google contact然后直接打电话发短信，打开web QQ直接和好友视频(现在webqq的视频聊天功能还需要插件支持，而且不支持mobile)。。。</p>
<p>web app真正的春天，就要来了吗？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/on-mozilla-boot-to-geckos-profile-and-expectations.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>-webkit-filter是神马？</title>
		<link>http://www.qianduan.net/what-is-webkit-filter.html</link>
		<comments>http://www.qianduan.net/what-is-webkit-filter.html#comments</comments>
		<pubDate>Fri, 23 Dec 2011 11:52:13 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front News]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12932</guid>
		<description><![CDATA[这两天有看到国外网站纷纷介绍-webkit-filter，开始很迷惑，丫是想要学IE吗？今天看了下，和IE的滤镜没一毛关系啊，而且，效果很赞... ]]></description>
			<content:encoded><![CDATA[<p>这两天有看到国外网站纷纷介绍-webkit-filter，开始很迷惑，丫是想要学IE吗？今天看了下，和IE的滤镜没一毛关系啊，而且，效果很赞！<span id="more-12932"></span></p>
<p>这些滤镜效果最初是用于SVG的，W3C引入到CSS中，然后制定了<a title="css filter effect 1.0" href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html" target="_blank">CSS Filter Effects 1.0</a>，现在webkit率先支持了它。</p>
<p>现在规范中支持的效果有：</p>
<ul>
<li>grayscale 灰度</li>
<li>sepia 褐色</li>
<li>saturate 饱和度</li>
<li>hue-rotate 色相旋转</li>
<li>invert 反色</li>
<li>opacity 透明度</li>
<li>brightness 亮度</li>
<li>contrast 对比度</li>
<li>blur 模糊</li>
<li>drop-shadow 阴影</li>
</ul>
<p>嗯，有些和CSS3重复了，不过，具体要怎么用还要看具体情况，至少我们可以用不同的方法实现同样的效果——比如透明度。</p>
<p>用法是标准的CSS写法：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">-webkit-filter<span style="color: #00AA00;">:</span> blur<span style="color: #00AA00;">&#40;</span><span style="color: #933;">2px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>然后，Eric Bidelman<a title="CSS Filter Effects" href="http://html5-demos.appspot.com/static/css/filters/index.html" target="_blank">写了一个demo</a>，可以很方便的查看各种效果。但是考虑到某网站因为不明原因在国内无法访问，我将该demo页面简单的翻译了下，<a title="CSS Filter Effects" href="http://labs.qianduan.net/css_filter.html" target="_blank">放到这边给大家预览，请猛击查看</a>。</p>
<p>请注意，改滤镜目前只有最新的<a title="webkit nightly" href="http://nightly.webkit.org/" target="_blank">webkit nightly</a>版本和<a title="chrome dev channel" href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=6&amp;ved=0CF8QFjAF&amp;url=http%3A%2F%2Fwww.google.com%2Fchrome%2Fintl%2Fen%2Feula_dev.html&amp;ei=GWD0Tq2hLovkrAfv3ojtDw&amp;usg=AFQjCNFc6aJq0n3DNLjLkV2ArUF5r58pmA&amp;sig2=rzPxXvCeMdRmC5wwhyYRsA" target="_blank">Chrome 18.0.976以上</a>版本才支持，所以你需要下载一个最新的版本来体验～～我用的是webkit nightly。</p>
<p>现在，让我们看一下一些简单的效果吧：</p>
<p>原图<br />
<img title="filter 原图" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter.jpg" alt="" width="366" /></p>
<p>模糊<br />
<img title="filter 灰度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_blur.jpg" alt="" width="366" /></p>
<p>50%灰度<br />
<img title="filter 灰度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_grayscale.jpg" alt="" width="366" /></p>
<p>100%灰度<br />
<img title="filter 灰度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_grayscale2.jpg" alt="" width="366" /></p>
<p>50%褐色<br />
<img title="filter 褐色" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_sepia.jpg" alt="" width="366" /></p>
<p>100%褐色<br />
<img title="filter 褐色" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_sepia2.jpg" alt="" width="366" /></p>
<p>50%亮度<br />
<img title="filter 亮度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_brightness.jpg" alt="" width="366" /></p>
<p>100%亮度<br />
<img title="filter 亮度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_brightness2.jpg" alt="" width="366" /></p>
<p>色相<br />
<img title="filter 色相" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_hue.jpg" alt="" width="366" /></p>
<p>反色<br />
<img title="filter 反色" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_invert.jpg" alt="" width="366" /></p>
<p>饱和度<br />
<img title="filter 饱和度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_saturate.jpg" alt="" width="366" /></p>
<p>对比度<br />
<img title="filter 对比度" src="http://www.qianduan.net/wp-content/uploads/2011/12/filter_contrast.jpg" alt="" width="366" /></p>
<p>嗯，我们在手机端的各种特效如lomo、日系等，也可以在页面简单实现一些了，配合css3内阴影、遮罩、渐变等，相信不必instagram等差多少。</p>
<p>ps:sepia的翻译貌似有点儿问题，求专业指点。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/what-is-webkit-filter.html/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>新版 Firefox 体验活动[深圳站]</title>
		<link>http://www.qianduan.net/new-firefox-experience-shenzhen-station.html</link>
		<comments>http://www.qianduan.net/new-firefox-experience-shenzhen-station.html#comments</comments>
		<pubDate>Mon, 19 Dec 2011 07:20:31 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12925</guid>
		<description><![CDATA[Firefox中国区的新版firefox体验活动，已经在国内几个城市举办过了，我去参加了11月份的广州站，很有收获的说。2012年1月7日，深圳站也将举行了～... ]]></description>
			<content:encoded><![CDATA[<p>Firefox中国区的新版firefox体验活动，已经在国内几个城市举办过了，我去参加了11月份的广州站，很有收获的说。2012年1月7日，深圳站也将举行了～～</p>
<p><strong>活动时间：</strong>2012年1月7日（下午1:30pm &#8211; 5:00pm）</p>
<p><strong>活动地点</strong>：深圳市南山区高薪中一路腾讯大厦2楼多功能厅</p>
<p><strong>活动内容：</strong></p>
<ul>
<li>Firefox 及移动版新特性演示</li>
<li>HTML 5特性介绍</li>
<li>Javascript 开发技巧</li>
</ul>
<p>另外，据说这次还会有专门介绍Mozilla最新的<a title="boot to gecko" href="https://wiki.mozilla.org/B2G" target="_blank">B2G技术</a>，这个好期待～～</p>
<p>总之，作为前端和针对移动设备的开发者，能够直接听到/看到Firefox官方的技术介绍和讲座，是个很不错的机会吧，貌似会上会有各种礼物赠送大家不要错过哦～～</p>
<p>报名传送门：<a title="新版 Firefox 体验活动[深圳站]" href="http://mozilla.com.cn/event/59-ff9-launch-party/" target="_blank">新版 Firefox 体验活动[深圳站]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/new-firefox-experience-shenzhen-station.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Opera 11.60发布，更好的支持HTML5</title>
		<link>http://www.qianduan.net/opera-11-60-release-better-support-for-html5.html</link>
		<comments>http://www.qianduan.net/opera-11-60-release-better-support-for-html5.html#comments</comments>
		<pubDate>Wed, 07 Dec 2011 05:36:25 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[Opera]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12896</guid>
		<description><![CDATA[Firefox加快了版本的更新速度，其实，Opera也一直没有停止前进的步伐，而且，版本号策略相对来说更稳重一些～～最新版11.60发布了，然后增加了一些令人心动的特性～～... ]]></description>
			<content:encoded><![CDATA[<p>Firefox加快了版本的更新速度，其实，Opera也一直没有停止前进的步伐，而且，版本号策略相对来说更稳重一些～～最新版11.60发布了，然后增加了一些令人心动的特性～～</p>
<ul>
<li>HTML5 parser
<p>Opera 11.60采用了名为Ragnarök 的解释器，能够更好的渲染错误的标签，据说可以解决20%的网站兼容问题。</p>
</li>
<li>HTML custom protocol和content handler
<p>支持HTML自定义协议和内容处理，比如mailto和tel属性以及特定的MIME类型。<a href="http://my.opera.com/ODIN/blog/2011/11/07/custom-protocol-and-content-handlers" target="_blank">具体看这里。</a></p>
</li>
<li>完整支持ES 5.1</li>
<li>更好的支持HTML5 video
<p>支持muted、preload、buffered和seekable属性。</p>
</li>
<li>支持发散渐变
<p>终于支持css3 radial gradient了</p>
</li>
</li>
<li>支持rem单位</li>
<li>box-shadow修正
<p>开始支持box-shadow的inset参数，用来实现内阴影的效果。</p>
</li>
<li>开始支持CSS4 image-rendering属性
<p>是的，你没有看错，是css4，其实webkit和gecko早支持了。。。用来优化图片的渲染</p>
</li>
<li>终于支持microdata了</li>
</ul>
<p>其实这些特性是计划在12.0中发布的，但是据说硬件加速功能可能会比较耗时间，于是11.60仅仅是一个过渡版本。。。</p>
<p>好吧，我个人一直没有用Opera的原因是，龙飞真的太慢太慢太慢了——opera的调试器Dragonfly，是谁开始喊它龙飞的？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/opera-11-60-release-better-support-for-html5.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>响应式网页设计</title>
		<link>http://www.qianduan.net/responsive-web-design.html</link>
		<comments>http://www.qianduan.net/responsive-web-design.html#comments</comments>
		<pubDate>Tue, 01 Nov 2011 16:36:11 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front News]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[响应式]]></category>
		<category><![CDATA[移动互联网]]></category>
		<category><![CDATA[设计]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12868</guid>
		<description><![CDATA[这个话题最近很火爆，我也一直在关注，响应式网页设计和移动互联网密切相关，并因移动终端的丰富和普及而兴盛，并且是一个颇具争议的话题，我今天将和大家探讨下... ]]></description>
			<content:encoded><![CDATA[<p>这个话题最近很火爆，我也一直在关注，响应式网页设计和移动互联网密切相关，并因移动终端的丰富和普及而兴盛，并且是一个颇具争议的话题，我今天将和大家探讨下。<span id="more-12868"></span></p>
<p>上周写了个简单的ppt在组内大概介绍了下，感兴趣的话可以<a href="http://mienflying.bitbucket.org/responsive/">先看下这个PPT</a>。</p>
<h3>移动互联网的现状和未来</h3>
<p>在说到这个话题前，我们先看下网页设计和前端开发的现状：</p>
<ol>
<li>全球有超过53亿手机用户（包括传统手机）</li>
<li>国内3G用户超过1亿</li>
<li>iPhone4手机在2010年出货量超过3000万部；</li>
<li>iPhone 4S上市前3天卖掉400万部；</li>
<li>Android手机每天激活超过50万部；</li>
<li>iPad出货量已经超过2.5亿部；</li>
<li>预计到2015年，移动互联网的数据流量<a title="[图表]移动互联网的现状和趋势" href="http://www.qianduan.net/chart-status-and-trends-of-mobile-internet.html" target="_blank">将超越桌面端的流量</a>。</li>
<li>。。。</li>
</ol>
<p>嗯，大家也许已经开始注意到，自己和身边的朋友也都越来越多的用上了iPhone或者android手机或平板——一两年前我们预料的移动互联网时代即将来临，现在已然实现了——我们正处在移动互联网快速发展的时代——已经不再是起步阶段了。</p>
<h3>那么，什么是响应式网页设计？</h3>
<p>响应式网页设计是<a title="Responsive Web Design" href="http://www.alistapart.com/articles/responsive-web-design/" target="_blank">Ethan Marcotte在去年5月份提出的一个概念</a>，简而言之，就是一个网站能够兼容多个终端——而不是为每个终端做一个特定的版本。这个概念可以说是是为移动互联网而生的！</p>
<p>或许大家之前会注意到，有很多知名网站都推出了iPhone或针对智能手机的专门网站，比如3g.qq.com、m.taobao.com、ipad.xxx.com等等。。。甚至前端观察之前也尝试过用wordpress插件实现m.qianduan.net的移动网站。</p>
<p>那么问题就来了——我们要为每一个设备做一个单独的网站吗？来让网站在每个设备中得到相应的视觉风格和操作体验？</p>
<p>这样势必就要增加很多的工作量，而且很多还是重复的。</p>
<p>我们在做页面的时候，一般很强调模块化的概念，我们要求一个合格的模块要能够“可扩展、无侵染”，它要能够用在任何地方都能够正常的显示。响应式网页设计与此类似——网站在任何设备中都能够正常适配，而不用为每个设备单独做个子网站！</p>
<p>但是，产品经理和设计师可能还是会要求网站在各个浏览器里面表现要一模一样，甚至要像素还原——WTF！不同的浏览器本身的功能、行为和处理方式都不一样，为什么要表现完全一样？！</p>
<p>let the browser flow&#8230;</p>
<h3>怎么做？</h3>
<p>其实响应式网页的实现很简单，都是大家熟悉的技术。</p>
<h4>media query(媒体查询)</h4>
<p>因为现在主流的智能终端都是基于iOS和Android的，而它们自带的浏览器都是基于webkit内核，所以我们可以完全使用viewport属性和media query技术实现网站的响应性：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;viewport&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width=device-width, initial-scale=1, maximum-scale=1&quot;</span>&gt;</span></pre></div></div>

<p>后面的initial-scale表示初始缩放，maximum-scale表示最大缩放比例，1意味着不能进行缩放。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* for 240 px width screen */</span>
<span style="color: #a1a100;">@media only screen and (max-device-width:240px){</span>
    selector<span style="color: #00AA00;">&#123;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* for 360px width screen */</span>
<span style="color: #a1a100;">@media only screen and (min-device-width:241px) and (max-device-width:360px){</span>
    selector<span style="color: #00AA00;">&#123;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* for 480 px width screen */</span>
<span style="color: #a1a100;">@media only screen (min-device-width:361px)and (max-device-width:480px){</span>
    selector<span style="color: #00AA00;">&#123;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>当然依靠屏幕宽度来进行适配是最简单的方法，media query有很多参数可以使用比如orientation、aspect-ratio等，不太了解的可以查看<a title="media type与media query" href="http://www.qianduan.net/media-type-and-media-query.html" rel="bookmark">这篇详细的介绍</a>。</p>
<p>其实，media query是响应式网页设计中被用到最多的技术。</p>
<h4>fluid grid(流体网格)</h4>
<p>很多项目都在使用网格技术(或者叫栅格)，前几年960.gs很流行，但是随着屏幕分辨率的普遍提升，它已经不太适合当前需求了，于是最近几年fluid grid开始逐渐多了起来，这种技术其实也很简单，只是将格栅的单位由px变成%，用百分比来控制页面每列的宽度，从而实现宽度的自适应。</p>
<p>使用流体网格的网站能够根据屏幕宽度自动调整页面中每列的宽度，从而保证页面的完整展现和基本功能。这也是一种不错的方法。</p>
<h4>flex box</h4>
<p>flex box是css3中的新技术，它很强大，可以实现很多我们之前无法想象的自适应布局。</p>
<p>有时我们希望网站能够以webapp的外观呈现给手机用户，flexbox是个不二的选择。</p>
<p>比如，要实现这样的简单结构：</p>
<p><img class="alignnone size-full wp-image-12874" title="flex box layout" src="http://www.qianduan.net/wp-content/uploads/2011/11/flex.jpg" alt="" width="312" height="402" /></p>
<p>它很像一个app的结构，头部和底部固定，中间高度自适应，用flexbox可以简单实现：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">.flex_wrap<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> box<span style="color: #00AA00;">;</span>  
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> -moz-box<span style="color: #00AA00;">;</span>  
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> -webkit-box<span style="color: #00AA00;">;</span>
	-webkit-box-orient<span style="color: #00AA00;">:</span> vertical<span style="color: #00AA00;">;</span>
	-moz-box-orient<span style="color: #00AA00;">:</span> vertical<span style="color: #00AA00;">;</span>
	box-orient<span style="color: #00AA00;">:</span> vertical<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
.flex_bd<span style="color: #00AA00;">&#123;</span>
	box-flex<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
	-moz-box-flex<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span> 
	-webkit-box-flex<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#E7E7E7</span><span style="color: #00AA00;">;</span>
	overflow-y<span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
.flex_hd<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#16364C</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFF</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">700</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span><span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
.flex_ft<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>HTML代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flex_wrap&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flex_hd&quot;</span>&gt;</span>前端观察<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flex_bd&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>这里是主内容区<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>这里是主内容区<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flex_ft&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.qianduan.net/about&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;关于我们&quot;</span>&gt;</span>关于我们<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.qianduan.net/copyright&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;版权声明&quot;</span>&gt;</span>版权声明<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.qianduan.net/sitemap&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;网站地图&quot;</span>&gt;</span>网站地图<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>虽然这里还会有点儿问题，比如主内容区域内容太多会被隐藏掉，因为android webkit和iOS 5之前的mobile safari均不支持overflow:scroll属性，但是这个问题还是很好解决的，比如在里面嵌套一个子容器，用js来给定个高度并使用定位来实现滚动条从而完整展示内容，或者直接使用iscroll等js库来实现。好消息是，iOS5中safari开始支持overflow:scroll了。</p>
<h3>不足之处</h3>
<p>如果你关注网站性能之类的话，可能已经发现了一些问题：</p>
<ul>
<li>加载很多不需要的资源，比如多余的图片和样式内容</li>
<li>带宽限制</li>
<li>移动终端的内存和CPU限制</li>
<li>图片大小和屏幕大小不匹配</li>
</ul>
<p>嗯，任何一个方案都不是完美的，但也不会很糟糕。下面我们会提到一些可行的优化方案：</p>
<h4>HTML5本地存储</h4>
<p>对于支持HTML5 appcache /manifest特性的浏览器，我们可以将一些不常改动的静态资源存储到本地，比如css文件，css中用到的图片，以及一些js文件等：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">CACHE MANIFEST
NETWORK:
/*
&nbsp;
CACHE:
img/bg.jpg
img/days.otf
slideshow.js
slideshow.css
classList.js</pre></td></tr></table></div>

<p>然后将文件保存为manifest格式，并在HTML标签中引入即可：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> manifest<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;responsive.manifest&quot;</span>&gt;</span></pre></div></div>

<p>这样，用户在第一次访问的时候会慢一点儿，但是后续访问会很快，3G网络中也能为用户节省带宽。</p>
<h4>移动设备优先</h4>
<p>一种新的设计流程是，先为移动设备设计界面，然后将PC端作为一个扩展。</p>
<p>这样做的好处是显而易见的，移动终端不会加载多余的资源，也不会因为PC端的样式而重绘页面，同时也不会影响PC端的表现。</p>
<h4>流体图片(fluid image)</h4>
<p>页面中的图片有时会比手机/平板的屏幕（viewport）宽，这样会将页面容器撑开，但是移动浏览器又不能scroll，结果图片被切掉一部分，然后还会有一部分内容被隐藏掉，用户看不到。</p>
<p>解决这个问题的方法很简单，将img的最大宽度设置成100%就可以了：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">img<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">max-width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>嗯，这里的前提是，没有给img标签设置宽度和高度，否则显示会有问题。另外不建议直接设置width=&#8221;100%&#8221;，因为会把小图拉大，模糊显示。</p>
<p>同理，video标签和iframe标签的宽度也可以这样做，而且最好不要使用iframe，宽度是个问题，性能也是一个方面吧。</p>
<h4>CSS3 image</h4>
<p>这个方法有些惊艳</p>
<p>我们都知道可以用::before和::after伪元素+content属性来动态显示一些内容或者做其它很酷的事情，而且在CSS 2.1中即被支持。不过content属性在CSS 2.1中只能用于这两个伪元素中，而在CSS3中，任何元素都可以使用content属性了，这个方法就是结合css3 的attr属性和HTML自定义属性的功能：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image.jpg&quot;</span> </span>
<span style="color: #009900;">	data-src-600px<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image-600px.jpg&quot;</span> </span>
<span style="color: #009900;">	data-src-800px<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image-800px.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span></pre></div></div>

<p>然后用media query来动态赋值：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@media (min-device-width:600px) { </span>
	img<span style="color: #00AA00;">&#91;</span>data-src<span style="color: #933;">-600px</span><span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> attr<span style="color: #00AA00;">&#40;</span>data-src<span style="color: #933;">-600px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> 
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #a1a100;">@media (min-device-width:800px) {</span>
	img<span style="color: #00AA00;">&#91;</span>data-src<span style="color: #933;">-800px</span><span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> attr<span style="color: #00AA00;">&#40;</span>data-src<span style="color: #933;">-800px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>当然，这种方法也有不足之处，比如PC端宽屏幕需要加载两个图片文件，然后我们也要为此准备多张图片文件等。</p>
<h4>pre标签</h4>
<p>有的网站，比如，像前端观察这样的技术博客，会用pre来显示源代码，而浏览器对pre标签默认设置white-space:pre，这样，代码就不会换行，从而撑开子容器，造成内容被隐藏的问题：</p>
<p><img class="alignnone size-full wp-image-12877" title="pre" src="http://www.qianduan.net/wp-content/uploads/2011/11/pre.jpg" alt="" width="427" height="427" /></p>
<p>右边的文字被隐藏掉了。</p>
<p>解决方法很简单：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">pre<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #3333ff;">:pre-wrap
	</span>word-wrap<span style="color: #00AA00;">:</span> break-word<span style="color: #00AA00;">;</span>
	word-break<span style="color: #00AA00;">:</span> break-all<span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/*如果要兼容IE，可以加上这句，连续字母断行的问题伤不起啊。。。。*/</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>当然，不只是pre标签，关键是white-space和word-break属性的值。</p>
<p>嗯，主要的技术和技巧其实就这些，大家不会陌生。下面是一些比较有用的工具什么的：</p>
<h3>响应式网页设计工具与资源</h3>
<p>国外在响应式网页设计上已经走的很远了，已经有很多工具和资源供我们参考和使用：</p>
<h4>CSS 框架</h4>
<ul>
<li><a href="http://stuffandnonsense.co.uk/projects/320andup/">320 and Up</a>
</li>
<li><a href="http://html5boilerplate.com/mobile/">Mobile Boilerplate</a>
</li>
<li><a href="http://goldengridsystem.com/" class="external" rel="nofollow">Golden Grid System</a>
</li>
<li><a href="http://thatcoolguy.github.com/gridless-boilerplate/" class="external" rel="nofollow">Gridless</a>
</li>
<li><a href="http://lessframework.com/" class="external" rel="nofollow">Less Framework</a>
</li>
<li><a href="http://cssgrid.net/" class="external" rel="nofollow">1140 CSS Grid System</a>
</li>
<li><a href="http://www.designinfluences.com/fluid960gs/" class="external" rel="nofollow">Fluid 960 Grid System</a>
</li>
<li><a href="http://simplegrid.info/" class="external" rel="nofollow">SimpleGrid</a>
</li>
<li><a href="http://www.getskeleton.com/" class="external" rel="nofollow">Skeleton</a>
</li>
</ul>
<h4>实用工具</h4>
<ul>
<li><a href="http://filamentgroup.com/lab/respondjs_fast_css3_media_queries_for_internet_explorer_6_8_and_more/">Respond.js</a>，让IE6-8支持meidia query
</li>
<li><a href="http://mattkersley.com/responsive/">Responsive Design Testing</a> 简单而方便的测试网站的响应性的工具，输入网址即可看到网站在不同分辨率下的表现</li>
</li>
<li><a href="http://resizemybrowser.com/">Resize My Browser</a> 缩放浏览器工具，不过不支持chrome和opera浏览器
</li>
<li><a href="http://seesparkbox.com/foundry/media_query_bookmarklet">Media Query Bookmarklet</a> 顾名思义，这是一个关于media query的书签工具
</li>
<li><a href="http://protofluid.com/">ProtoFluid</a> 在线查看和调试网站对移动终端兼容性的工具，很赞
</li>
<li><a href="http://quirktools.com/screenfly/">ScreenFly</a> 和ProtoFluid类似
</li>
<li><a href="http://responsivepx.com/" class="external" rel="nofollow">responsivepx</a> 更直观的测试网站对不同分辨率的适配性
</ul>
<h3>争论和总结</h3>
<p>响应式网页设计被提出以来，争论就不断，其实核心问题只有两个个：太多的资源请求和有限的终端支持之间的矛盾、响应式的网页设计和移动终端在用户体验和视觉风格上的差异。前者不能容忍在弱小的手机/平板上通过龟速的3G/2G网络来加载一个笨重的PC端页面，而后者纠结响应式网站不像手机网站。</p>
<p>我的想法是，具体问题具体分析，比如，强内容的网站，完全可以尝试响应式网站，而重视觉和功能的网站，则可以尝试建立一个独立的移动网站。</p>
<p>另外，显然，响应式网页设计的大部分技术，是可以用在WebApp开发中的。</p>
<p>最后，欢迎各种吐槽、各种批评、各种建议、各种发散、以及各种新观点新技术～～欢迎发表评论～～</p>
<p>PS：如果你手上有android/iPhone，可以直接访问下<a href="http://www.qianduan.net" title="前端观察">前端观察</a>。 :)</p>
<h4>参考文章：</h4>
<ul>
<li><a href="http://www.smashingmagazine.com/2011/07/22/responsive-web-design-techniques-tools-and-design-strategies/">Responsive Web Design Techniques, Tools and Design Strategies</a></li>
<li>
<a href="http://www.alistapart.com/articles/responsive-web-design/">Responsive Web&nbsp;Design</a></li>
<li><a href="http://www.webdesignerdepot.com/2011/09/the-ultimate-responsive-web-design-roundup/" rel="bookmark" title="Permanent Link to The ultimate responsive web design roundup">The ultimate responsive web design roundup</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/responsive-web-design.html/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>iPhone 4S 浏览器性能预览</title>
		<link>http://www.qianduan.net/iphone-4s-browser-preview-performance.html</link>
		<comments>http://www.qianduan.net/iphone-4s-browser-preview-performance.html#comments</comments>
		<pubDate>Fri, 21 Oct 2011 10:27:48 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[ios5]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12853</guid>
		<description><![CDATA[iPhone 4S已经正式发售，虽然在国内还只能是水货，但是显然已经国外的同行已经开始研究它能给我们带来的改变了，而我们关注的，依然是浏览器～～ iPhone 4S硬件主要升级CPU和GPU，而这些给升... ]]></description>
			<content:encoded><![CDATA[<p>iPhone 4S已经正式发售，虽然在国内还只能是水货，但是显然已经国外的同行已经开始研究它能给我们带来的改变了，而我们关注的，依然是浏览器～～</p>
<p><span id="more-12853"></span>iPhone 4S硬件主要升级CPU和GPU，而这些给升级也为浏览器性能带来了很大的提升：</p>
<table style="margin-bottom: 20px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th><strong>Apple</strong></th>
<th><strong>iPad</strong></th>
<th><strong>iPhone 4</strong></th>
<th><strong>iPad 2</strong></th>
<th><strong>iPhone 4S</strong></th>
</tr>
<tr>
<td valign="top"><strong>SoC</strong></td>
<td colspan="2" valign="top"><strong>A4</strong></td>
<td colspan="2" valign="top"><strong>A5</strong></td>
</tr>
<tr>
<td valign="top"><strong>处理器</strong></td>
<td valign="top">1 GHz ARM Cortex-A8 (单核)</td>
<td valign="top">800 MHz ARM Cortex-A8 (单核)</td>
<td valign="top">1 GHz ARM Cortex-A9 (双核)</td>
<td valign="top">800 MHz ARM Cortex-A9 (双核)</td>
</tr>
<tr>
<td valign="top"><strong>内存</strong></td>
<td valign="top">256 MB LP-DDR (单通道)</td>
<td valign="top">512 MB LP-DDR (单通道)</td>
<td colspan="2" valign="top">512 MB LP-DDR2 (双通道)</td>
</tr>
<tr>
<td valign="top"><strong>图形</strong></td>
<td colspan="2" valign="top">PowerVR SGX535 (单核)</td>
<td colspan="2" valign="top">PowerVR SGX545MP2 (双核)</td>
</tr>
<tr>
<td valign="top"><strong>L1 缓存</strong><strong></strong></p>
<p><strong>(指令/数据)</strong></td>
<td colspan="2" valign="top">32 KB / 32 KB</td>
<td colspan="2" valign="top">32 KB / 32 KB</td>
</tr>
<tr>
<td valign="top"><strong>L2 缓存</strong></td>
<td colspan="2" valign="top">640 KB</td>
<td colspan="2" valign="top">1 MB</td>
</tr>
</tbody>
</table>
<h3>JavaScript 性能</h3>
<p>硬件升级带来的直接结果就是，在SunSpider测试中，iPhone 4S性能提升很大：</p>
<table style="margin-bottom: 20px;">
<tbody>
<tr>
<th>SunSpider JS Benchmark</th>
<th>iPhone 4<br />
iOS 4.3</th>
<th>iPhone 4<br />
iOS 5</th>
<th>iPhone 4S</p>
<p>iOS 5</th>
</tr>
<tr>
<td valign="top" width="168"><strong>UIWebView</strong></td>
<td valign="top" width="79">10,044</td>
<td valign="top" width="120">12,101</p>
<p><span style="color: #ff0000;">(慢20%)</span></td>
<td valign="top" width="227">8,955 <span style="color: #008000;">(比iPhone 4快26% , 总提高11%)</span></td>
</tr>
<tr>
<td valign="top" width="168"><strong>MobileSafari</strong></td>
<td valign="top" width="79">4,052</td>
<td valign="top" width="120">3,574</p>
<p><span style="color: #008000;">(快12%)</span></td>
<td valign="top" width="227">2,215<span style="color: #008000;"> (比iPhone 4快38%, 总提高46%)</span></td>
</tr>
<tr>
<td valign="top" width="168"><strong>Home-Screen Pages</strong></td>
<td valign="top" width="79">10,528</td>
<td valign="top" width="120">4,551</p>
<p><span style="color: #008000;">(快57%)</span></td>
<td valign="top" width="227">2,227 <span style="color: #008000;">(比iPhone 4快52%, 总提高79%)</span></td>
</tr>
</tbody>
</table>
<p>嗯，最大的亮点还是Home-Screen Page，也就是webapp，提升了4倍多。。。而UIWebView真的限制很大，其实，android上的WebView组件也很搓。。。</p>
<p>渲染性能</p>
<p>iOS5的GPU加速功能很给力，加上GPU硬件本身的提升，在iPhone 4S上表现很赞：</p>
<table style="margin-bottom: 20px;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th valign="top" width="148">Device / OS</th>
<th valign="top" width="148">FPS</th>
</tr>
<tr>
<td valign="top" width="148"><strong>iPhone 4  iOS 4.3</strong></td>
<td valign="top" width="148">2 FPS</td>
</tr>
<tr>
<td valign="top" width="148"><strong>iPhone 4  iOS 5</strong></td>
<td valign="top" width="148">40 FPS</td>
</tr>
<tr>
<td valign="top" width="148"><strong>iPhone 4S iOS 5</strong></td>
<td valign="top" width="148">60 FPS</td>
</tr>
</tbody>
</table>
<p>有没有HTML5/CSS3能力被解放的感觉？我们可以尝试更丰富的视觉表现了。</p>
<h3>页面加载时间</h3>
<p>测试人员在iPhone4/iPhone4+iOS5和iPhone4S上测试了Alexa中排名前500的网站的页面加载时间，反复测试，发现iPhone 4S平均加载速度提高了13%，而只有60%的页面速度有明显提升，其它到没有太大的差异。这可能是因为JavaScript性能的提升，而页面中用到的JS越多，提升越明显，而用的少的则表现并不明显。</p>
<h3>结语</h3>
<p>这里我想说的和上一篇文章《<a title="永久链接到 iOS 5中safari带来的新特性" href="http://www.qianduan.net/ios-5-brings-new-features-in-safari.html" rel="bookmark">iOS 5中safari带来的新特性</a>》是一致的，WebApp会带来更好的性能，基于UIWebView的Native APP则继续承受各种限制。虽然现在说WebApp的春天来了可能为时尚早，但是显然是一个很大的鼓舞。</p>
<p>内容整理自：<a href="http://www.blaze.io/mobile/iphone-4s-browser-performance-review/">iPhone 4S Browser Performance Review<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/iphone-4s-browser-preview-performance.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iOS 5中safari带来的新特性</title>
		<link>http://www.qianduan.net/ios-5-brings-new-features-in-safari.html</link>
		<comments>http://www.qianduan.net/ios-5-brings-new-features-in-safari.html#comments</comments>
		<pubDate>Sat, 15 Oct 2011 15:32:36 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front News]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[ios5]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[web app]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12832</guid>
		<description><![CDATA[随着iPhone4s的发布，iOS5也正是发布了，增加了很多很有用的新特性，不过对于前端开发者来说，最关心的还是浏览器，让我们来看一下苹果为iOS5中的safari新增恶劣哪些新特性吧。... ]]></description>
			<content:encoded><![CDATA[<p>随着iPhone4s的发布，iOS5也正是发布了，增加了很多很有用的新特性，不过对于前端开发者来说，最关心的还是浏览器，让我们来看一下苹果为iOS5中的safari新增了哪些新特性吧。<span id="more-12832"></span></p>
<h3>CSS</h3>
<ul>
<li>终于支持position:fixed了；</li>
<li>支持overflow:scroll了，通过-webkit-overflow-scrolling: touch;来实现：

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">selector<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">scroll</span><span style="color: #00AA00;">;</span>
-webkit-overflow-scrolling<span style="color: #00AA00;">:</span> touch<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

</li>
<li>CSS3 gradient语法更新，将-webkit-gradient(linear|radial)拆分为，-webkit-linear-gradient和-webkit-radial-gradient。PS，年初发表过一篇关于《<a title="查看 webkit对于CSS3渐变样式语法的更新" href="http://www.qianduan.net/webkit-style-syntax-for-the-gradient-update-css3.html">webkit对于CSS3渐变样式语法的更新</a>》的文章，看来现在就剩下android的webkit了。</li>
</ul>
<h3>HTML5</h3>
<ol>
<li>新的兼容HTML5的解释器(parser)</li>
<li>表单增强新增时间类型date, datetime, month, time和range支持，好赞：
<p><img title="ios-date-input" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios-date-input.png" alt="" width="320" height="480" /></p>
<p><img title="ios-datetime-input" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios-datetime-input.png" alt="" width="320" height="480" /></p>
<p><img title="ios-month-input" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios-month-input.png" alt="" width="320" height="480" /></p>
<p><img title="ios-time-input" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios-time-input.png" alt="" width="320" height="480" /></p>
<p><img title="ios-range-input" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios-range-input.png" alt="" /></p>
<p>同时iOS5中safari也增强了number类型的input的验证功能。</li>
</ol>
<ul>
<li>支持<a title="web workers on whatwg" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html" target="_blank">web workers</a> ，传说iOS3中短暂出现过web workers，不过后来消失了，现在又回来了。。。</li>
<li>增强ECMAScript5，测试结果显示支持情况跟上PC版的Safari 5.1了。</li>
<li>终于支持contenteditable属性</li>
<li>支持async script</li>
</ul>
<h3>其它特性：</h3>
<ul>
<li><a title="维基百科：HTTP管线化" href="http://zh.wikipedia.org/wiki/HTTP%E7%AE%A1%E7%B7%9A%E5%8C%96" target="_blank">HTTP Pipelining</a>支持，Android中webkit和Opera都支持了，Mobile Safari也跟进了。想要具体了解的可以看下<a title="HTTP Pipelining – Big in Mobile" href="http://www.blaze.io/mobile/http-pipelining-big-in-mobile/" target="_blank">这里</a>和<a title="HTTP Pipelining – Request Distribution Algorithms " href="http://www.blaze.io/technical/http-pipelining-request-distribution-algorithms/" target="_blank">这里</a>。</li>
<li>inline SVG</li>
<li>UIWebView 和主屏幕webapp升级到Nitro引擎(看下面的测试数据)</li>
<li>支持MathML</li>
<li>CSS和其它文件<span style="color: #ff0000;"><strong>不再并行</strong></span>下载，这貌似挺悲剧的，不过我很感兴趣这和HTTP Pipelining的关系。。。</li>
<li>GPU硬件加速，虽然这个之前也有，但是效果并不是很显著，现在，在微软用于标榜IE9硬件加速的测试中，iOS达到了40FPS，而Windows Phone 7是24FPS，Nexus 2则只有可怜的10FPS——iOS4中只有2FPS。。。</li>
</ul>
<h3>一些测试数据</h3>
<ul>
<li>HTMLTest：267分，iOS 4.3中是206分</li>
<li>Sunspider JS Benchmark，JS性能测试：
<p><img class="alignnone size-full wp-image-12842" title="ios5benchmark" src="http://www.qianduan.net/wp-content/uploads/2011/10/ios5benchmark.png" alt="" width="564" height="349" /></p>
<p>可见首页webapp是用上Nitro引擎了，但是悲剧的是UIWebView的性能却下降了。</p>
<p>PS:中间的home screen page，<a href="http://csshouse.net/" target="_blank">@Jeanne</a> 美女说是主屏幕，不过我的理解就是webapp，如有更好的翻译欢迎讨论。</p>
</li>
</ul>
<h3>总结</h3>
<p>可以看出iOS 5中Safari改进还是蛮大的，而从最后webapp和UIWebView的性能测试来看，或许苹果更加重视了webapp，而不太赞成UIWebView+webapp的这种混搭的方式，虽然很多流行的app都是这种实现，比如著名的PhoneGap框架和Facebook/twitter等流行的在国内不能用的APP。。</p>
<h4>参考资源：</h4>
<ul>
<li><a href="http://www.blaze.io/mobile/ios5-top10-performance-changes/" target="_blank">iOS 5 Top 10 Browser Performance Changes</a></li>
<li><a href="http://davidbcalhoun.com/2011/new-mobile-safari-stuff-in-ios5-position-fixed-overflow-scroll-new-input-type-support-web-workers-ecmascript-5" target="_blank">New Mobile Safari stuff in iOS5</a></li>
<li><a href="http://www.mobilexweb.com/blog/ios-5-iphone-and-ipad-html5" target="_blank">Safari on iOS 5, HTML5 evolution for iPhone and iPad</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/ios-5-brings-new-features-in-safari.html/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>IE10将增强对HTML5和CSS3的支持</title>
		<link>http://www.qianduan.net/ie10-will-enhance-support-for-html5-and-css3.html</link>
		<comments>http://www.qianduan.net/ie10-will-enhance-support-for-html5-and-css3.html#comments</comments>
		<pubDate>Wed, 14 Sep 2011 04:33:00 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front News]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12734</guid>
		<description><![CDATA[Windows 8 终于发布了，虽然现在可用的只是开发者预览版，好消息是，IE 10 也随着发了，虽然现在还只有Windows 8可用。我们来看下IE10都有哪些新特性吧。... ]]></description>
			<content:encoded><![CDATA[<p>Windows 8 终于发布了，虽然现在可用的只是开发者预览版，好消息是，IE 10 也随着发了，虽然现在还只有Windows 8可用。我们来看下IE10都有哪些新特性吧。<span id="more-12734"></span></p>
<p>IE开发者中心给到了一份<a href="http://msdn.microsoft.com/en-us/ie/gg192966" target="_blank">详细的针对前端开发者的文档，列出了IE10支持的HTML5和CSS3新特性</a>。嗯，它终于跟上了：</p>
<h3>CSS3</h3>
<ul>
<li>css region</li>
<li>css3多列</li>
<li>Flexbox</li>
<li>grid</li>
<li>定位浮动(positioned float)</li>
<li>3D变换(3D transfrom)</li>
<li>动画(animation)</li>
<li>渐变(gradient)</li>
<li>text-shadow</li>
<li>去掉样式表限制——在IE9之前的版本中，每个页面最多只能加载31个样式表文件，@import也只能最多嵌套4层，IE10中去掉了这些限制。</li>
</ul>
<h3>HTML5</h3>
<div>
<ul>
<li>脚本同步——script标签的async属性，用来定义脚本是否异步执行</li>
<li>File API</li>
<li>History</li>
<li>Parsing</li>
<li>表单验证(form validation)</li>
<li>progress和range控制——其实也可以看作HTML5表单中的功能</li>
<li>web workers</li>
<li>web sockets</li>
<li>拖拽(drag and drop)</li>
<li>应用缓存——application cache，也就是离线存储，不过需要注意的是W3C更新了离线存储配置文件的扩展名，之前是ooxx.manifest，以后要用appcache扩展。</li>
<li>spellcheck</li>
<li>频道通信(channel messaging)</li>
</ul>
</div>
<h3>其它</h3>
<div>
<ul>
<li>Indexed Database</li>
<li>Web performance API</li>
<li>SVG 滤镜效果</li>
</ul>
</div>
<p>嗯，新东西很多，看起来还是很给力的。</p>
<p>需要注意的是，IE10对CSS3新特性的支持，大部分还是需要-ms-前缀的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/ie10-will-enhance-support-for-html5-and-css3.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>webrebuild 2011年会即将召开</title>
		<link>http://www.qianduan.net/webrebuild-2011-forthcoming-annual.html</link>
		<comments>http://www.qianduan.net/webrebuild-2011-forthcoming-annual.html#comments</comments>
		<pubDate>Tue, 09 Aug 2011 10:10:11 +0000</pubDate>
		<dc:creator>神飞</dc:creator>
				<category><![CDATA[Front News]]></category>
		<category><![CDATA[Webrebuild]]></category>

		<guid isPermaLink="false">http://www.qianduan.net/?p=12599</guid>
		<description><![CDATA[今年的webrebuild年会即将召开，嗯，应该是第五届了吧。... ]]></description>
			<content:encoded><![CDATA[<p>今年的<a href="http://webrebuild.org" target="_blank">webrebuild</a>年会即将召开，嗯，应该是第五届了吧。<span id="more-12599"></span></p>
<p>今年在4个城市召开，深圳是首站，8月20日召开，时间不多了，在深圳的同学迅速报名吧。</p>
<p>深圳站的嘉宾有三位，都是相当期待的：</p>
<p><img class="alignnone size-full wp-image-12600" title="webrebuild" src="http://www.qianduan.net/wp-content/uploads/2011/08/webrebuild.jpg" alt="" width="362" height="382" /></p>
<p>报名传送门：<a href="http://webrebuild.org/shenzhen/">http://webrebuild.org/shenzhen/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qianduan.net/webrebuild-2011-forthcoming-annual.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

