<?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>IInterest &#187; HTML5相关</title>
	<atom:link href="http://www.iinterest.net/tag/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iinterest.net</link>
	<description>关注移动互联网 &#38; HTML5</description>
	<lastBuildDate>Sat, 07 Jan 2012 08:07:27 +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>x-webkit-speech 语音输入功能</title>
		<link>http://www.iinterest.net/2012/01/07/x-webkit-speech/</link>
		<comments>http://www.iinterest.net/2012/01/07/x-webkit-speech/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 08:04:27 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[HTML5相关]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=1517</guid>
		<description><![CDATA[现在各大网站都在搜索框中加入了语音输入功能，不过目前只有Chrome 11及以上版本才支持。 可以用chrome浏览器在这里试试效果，点击话筒即可： 实现起来也非常简单，为input添加名为 x-webkit-speech 的属性就行了。 &#60;input type="text" x-webkit-speech /&#62; 相关的属性设置： lang 设置语言种类： &#60;input type="text" x-webkit-speech lang="zh-CN" /&#62; onwebkitspeechchange 语音输入事件，当发声语音改变时触发： &#60;input type="text" x-webkit-speech onwebkitspeechchange="foo()" /&#62; x-webkit-grammar 语音输入语法，”builtin:search”值使得语音输入的内容尽量靠近搜索内容，去除多余的字符，例如「的」 &#60;input type="text" x-webkit-speech x-webkit-grammar="builtin:search" /&#62; 还有个值：”builtin:translate”看到taobao在用，但目前还不清楚是什么意义，有时间再仔细看看W3C的文档。 测试了下效果，语音识别率还不错，但中英夹杂的时候就很悲剧了，而且该服务需要走google的服务器所以有时响应速度很慢，另外在mac中遇到提示“麦克风无法使用”的情况，猜测可能存在一些硬件兼容性问题。总的来说是趣味性大于实用性；比较期待能在手机浏览器上实现这个功能，可以做一些比较有趣的应用。 相关资料： http://www.w3.org/TR/capture-api/ http://www.w3.org/TR/xhtml+voice/ http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html]]></description>
			<content:encoded><![CDATA[<p>现在各大网站都在搜索框中加入了语音输入功能，不过目前只有Chrome 11及以上版本才支持。<br />
可以用chrome浏览器在这里试试效果，点击话筒即可：</p>
<div>
<input type="text" x-webkit-speech/></div>
<p>实现起来也非常简单，为input添加名为 x-webkit-speech 的属性就行了。<br />
<span id="more-1517"></span><br />
<code>&lt;input type="text" <span style="color:#ff6600">x-webkit-speech</span> /&gt;</code><br />
相关的属性设置：<br />
<strong>lang</strong><br />
设置语言种类：<br />
<code>&lt;input type="text" x-webkit-speech <span style="color:#ff6600">lang="zh-CN"</span> /&gt;</code><br />
<strong>onwebkitspeechchange</strong><br />
语音输入事件，当发声语音改变时触发：<br />
<code>&lt;input type="text" x-webkit-speech <span style="color:#ff6600">onwebkitspeechchange="foo()"</span> /&gt;</code></p>
<p><strong>x-webkit-grammar</strong><br />
语音输入语法，”builtin:search”值使得语音输入的内容尽量靠近搜索内容，去除多余的字符，例如「的」<br />
<code>&lt;input type="text" x-webkit-speech <span style="color:#ff6600">x-webkit-grammar="builtin:search"</span> /&gt;</code><br />
还有个值：”builtin:translate”看到taobao在用，但目前还不清楚是什么意义，有时间再仔细看看W3C的文档。</p>
<p>测试了下效果，语音识别率还不错，但中英夹杂的时候就很悲剧了，而且该服务需要走google的服务器所以有时响应速度很慢，另外在mac中遇到提示“麦克风无法使用”的情况，猜测可能存在一些硬件兼容性问题。总的来说是趣味性大于实用性；比较期待能在手机浏览器上实现这个功能，可以做一些比较有趣的应用。</p>
<p>相关资料：<br />
<a href="http://www.w3.org/TR/capture-api/" target="_blank">http://www.w3.org/TR/capture-api/</a><br />
<a href="http://www.w3.org/TR/xhtml+voice/" target="_blank">http://www.w3.org/TR/xhtml+voice/</a><br />
<a href="http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html" target="_blank">http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2012/01/07/x-webkit-speech/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>常用的CSS3文字特效</title>
		<link>http://www.iinterest.net/2011/06/25/css3-text-effect/</link>
		<comments>http://www.iinterest.net/2011/06/25/css3-text-effect/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 15:04:04 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5相关]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=1288</guid>
		<description><![CDATA[PS：请使用支持CSS3的浏览器，如Chrome、Firefox3.5+、Safari4+、Opera 文字阴影 text-shadow text-shadow是最为简单及常用的效果，而且有很多变换，这里列举一些有代表性的： 1.普通： .text-shadow{ text-shadow:1px 1px 2px #2c5103; color:#60ad0d; } Here is some text effect 2.3D： .text-3d{text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 &#8230; <a href="http://www.iinterest.net/2011/06/25/css3-text-effect/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<style>
s{ text-decoration:none; font-size:40px; font-family:"Arial Black"; padding:5px 10px; display:inline-block;}
.text-shadow{ text-shadow:1px 1px 2px #2c5103; color:#60ad0d; }
.text-3d{text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15); color:#fff; background:#3699f6; }
.text-light{ text-shadow:0 0 20px #ff6600; color:#fff; background:#333; }
.text-blur{ text-shadow:0 0 10px #fff; color:transparent; background:#333;}
.text-indent{text-shadow: 0 1px 1px #FFF; color: #717171; background:#d3d3d3;}
.text-carve{ text-shadow: -1px -1px #fff, 1px 1px #333; color: #CCC; background:#d3d3d3;}
.text-inner-shadow{ background: #666; -webkit-background-clip: text; -moz-background-clip: text; background-clip: text; color: transparent; text-shadow:rgba(255,255,255,0.5) 0px 3px 3px;}
p.orange::selection { background:#ff6600; color:#fff;}
.text-overlap{ position: relative; font: 130px Helvetica, Sans-Serif; letter-spacing: -5px; color: rgba(0,255,240,0.5);}
.text-overlap:after{ content: attr(title); position: absolute; left: 10px; top: 5px; color: rgba(255,6,0,0.5);}
</style>
<p>PS：请使用支持CSS3的浏览器，如Chrome、Firefox3.5+、Safari4+、Opera<br />
<strong>文字阴影 text-shadow</strong><br />
text-shadow是最为简单及常用的效果，而且有很多变换，这里列举一些有代表性的：<br />
1.普通：<br />
<code>.text-shadow{ text-shadow:1px 1px 2px #2c5103; color:#60ad0d; }</code><br />
<s class="text-shadow">Here is some text effect</s><br />
<span id="more-1288"></span><br />
2.3D：<br />
<code>.text-3d{text-shadow: 0 1px 0 #ccc,<br />
               0 2px 0 #c9c9c9,<br />
               0 3px 0 #bbb,<br />
               0 4px 0 #b9b9b9,<br />
               0 5px 0 #aaa,<br />
               0 6px 1px rgba(0,0,0,.1),<br />
               0 0 5px rgba(0,0,0,.1),<br />
               0 1px 3px rgba(0,0,0,.3),<br />
               0 3px 5px rgba(0,0,0,.2),<br />
               0 5px 10px rgba(0,0,0,.25),<br />
               0 10px 10px rgba(0,0,0,.2),<br />
               0 20px 20px rgba(0,0,0,.15);<br />
color:#fff; background:#3699f6;<br />
   }</code><br />
<s class="text-3d">Here is some text effect</s></p>
<p>4.外发光：<br />
<code>.text-light{ text-shadow:0 0 20px #ff6600; color:#fff; background:#333; }</code><br />
<s class="text-light">Here is some text effect</s></p>
<p>5.模糊：<br />
<code>.text-blur{ text-shadow:0 0 10px #fff; color:transparent; background:#333;}</code><br />
<s class="text-blur">Here is some text effect</s></p>
<p>6.凹痕：<br />
<code>.text-indent{text-shadow: 0 1px 1px #FFF; color: #717171; background:#d3d3d3;}</code><br />
<s class="text-indent">Here is some text effect</s></p>
<p>7.浮雕：<br />
<code>.text-carve{ text-shadow: -1px -1px #fff, 1px 1px #333; color: #CCC; background:#d3d3d3;}</code><br />
<s class="text-carve">Here is some text effect</s></p>
<p>结合其他CSS3样式做出的文字效果：<br />
<strong>内阴影：</strong><br />
这里用到了背景剪切，想了解更多请看这里 <a href="http://www.w3schools.com/css3/css3_pr_background-clip.asp" target="_blank">background-clip</a><br />
<code>.text-inner-shadow{ background: #666; -webkit-background-clip: text; -moz-background-clip: text; background-clip: text; color: transparent; text-shadow:rgba(255,255,255,0.5) 0px 3px 3px;}</code><br />
<s class="text-inner-shadow">Here is some text effect</s></p>
<p><strong>改变文字选取的默认颜色</strong><br />
用到了伪元素 <a href="http://www.w3schools.com/css3/sel_selection.asp" target="_blank">::selection</a><br />
<code>p.orange::selection { background:#ff6600; color:#fff;}</code></p>
<p class="orange">用鼠标选取这段文字就可以看到效果，用鼠标选取这段文字就可以看到效果，用鼠标选取这段文字就可以看到效果，用鼠标选取这段文字就可以看到效果。</p>
<p><strong>重叠文字</strong><br />
这里用了个伪类形成重叠的文字，注意伪类中content: attr(title)，直接取的title值。<br />
彩蛋：用红蓝眼镜看的话会有立体效果哦~(文字的颜色是根据自己的一副红蓝眼镜调配的，不知道适不适用其他的，呵呵)<br />
<code>.text-overlap{ position: relative; font: 130px Helvetica, Sans-Serif; letter-spacing: -5px; color: rgba(0,255,240,0.5);}<br />
.text-overlap:after{ content: attr(title); position: absolute; left: 10px; top: 5px; color: rgba(255,6,0,0.5);}</code></p>
<div class="text-overlap" title="IInterest">IInterest</div>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2011/06/25/css3-text-effect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用CSS3阴影制作立体感效果</title>
		<link>http://www.iinterest.net/2011/04/21/css3-box-shadow/</link>
		<comments>http://www.iinterest.net/2011/04/21/css3-box-shadow/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 09:32:26 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5相关]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=1175</guid>
		<description><![CDATA[CSS3非常强大，发挥想象力便可以用它制作出非常绚丽的效果，这里就使用CSS3的两个属性来制作具有立体感的效果。效果图如下： 使用的两个CSS3属性：box-shadow、transform，基本语法： box-shadow box-shadow:5px 2px 6px #000; 数值从左至右：阴影水平偏移值（正值向右，负值向左）；阴影垂直偏移值（正值向下，负值向上）；阴影模糊值；阴影颜色。 transform transform的效果很多，这里只用了旋转： transform: rotate(-3deg) 数值表示旋转的角度，正值为顺时针，负值为逆时针。 因为CSS3还是草案，所以现有浏览器的最新版都是以私有属性来支持transform，需要加上-webkit-、-moz-、-o-、-ms- 具体实现思路：为了突显立体感，要让阴影左右重中间轻，这里使用了::before,::after伪元素，创建并让它们定位在#Demo元素后(z-index:-1)，同时设置阴影，并设置旋转，把思路用图片来表示就是这样： 这就是我们想要的效果了，具体代码看Demo： &#60;!DOCTYPE HTML&#62; &#60;html&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34;&#62; &#60;title&#62;HTML5 box-shadow&#60;/title&#62; &#60;style type=&#34;text/css&#34;&#62; *{ margin:0; padding:0;} body{ background:#d7d7d7;} #demo{ display:inline-block; position:relative; margin:50px; padding:20px; background:#fafafa; box-shadow:0 &#8230; <a href="http://www.iinterest.net/2011/04/21/css3-box-shadow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>CSS3非常强大，发挥想象力便可以用它制作出非常绚丽的效果，这里就使用CSS3的两个属性来制作具有立体感的效果。效果图如下：</p>
<p><img src="http://www.iinterest.net/wp-content/uploads/2011/04/box-shadow1.jpg" alt="" title="box-shadow1" width="500" height="140" class="alignnone size-full wp-image-1176" /><br />
<span id="more-1175"></span><br />
使用的两个CSS3属性：box-shadow、transform，基本语法：<br />
<strong>box-shadow</strong></p>
<blockquote><p>
box-shadow:5px 2px 6px #000;<br />
数值从左至右：阴影水平偏移值（正值向右，负值向左）；阴影垂直偏移值（正值向下，负值向上）；阴影模糊值；阴影颜色。
</p></blockquote>
<p><strong>transform</strong><br />
transform的效果很多，这里只用了旋转：</p>
<blockquote><p>
transform: rotate(-3deg)<br />
数值表示旋转的角度，正值为顺时针，负值为逆时针。<br />
因为CSS3还是草案，所以现有浏览器的最新版都是以私有属性来支持transform，需要加上-webkit-、-moz-、-o-、-ms-
</p></blockquote>
<p>具体实现思路：为了突显立体感，要让阴影左右重中间轻，这里使用了::before,::after伪元素，创建并让它们定位在#Demo元素后(z-index:-1)，同时设置阴影，并设置旋转，把思路用图片来表示就是这样：<!--more--><br />
<img src="http://www.iinterest.net/wp-content/uploads/2011/04/box-shadow2.jpg" alt="" title="box-shadow2" width="500" height="125" class="alignnone size-full wp-image-1177" /><br />
这就是我们想要的效果了，具体代码看Demo：</p>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_hHDLzS">
&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;title&gt;HTML5 box-shadow&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
*{ margin:0; padding:0;}
body{ background:#d7d7d7;}
#demo{ display:inline-block; position:relative; margin:50px; padding:20px; background:#fafafa; box-shadow:0 0 3px rgba(0, 0, 0, 0.2); -moz-border-radius:4px; border-radius:4px; color:rgba(0,0,0, 0.8); text-shadow:0 1px 0 #fff;}
#demo::before, #demo::after{ position:absolute; content:&quot;&quot;; top:10px; bottom:15px; left:10px; width:50%; box-shadow:0 15px 10px rgba(0, 0, 0, 0.5); -webkit-transform: rotate(-3deg); -moz-transform:rotate(-3deg); -o-transform:rotate(-3deg); -ms-transform:rotate(-3deg); transform:rotate(-3deg); z-index:-1;}
#demo::after{ right:10px; left:auto; -webkit-transform:rotate(3deg); -moz-transform:rotate(3deg); -o-transform:rotate(3deg); -ms-transform:rotate(3deg); transform: rotate(3deg);}
#demo img{ vertical-align:bottom;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;demo&quot;&gt;
  &lt;img src=&quot;http://api.photoshop.com/home_aaa9cc05ee874f8fb3929d4ce5c41105/adobe-px-assets/e71ad2ef42e34821862244b04f533fd4&quot; width=&quot;650&quot; height=&quot;100&quot; /&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_hHDLzS');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_hHDLzS');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2011/04/21/css3-box-shadow/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>[转]如何为 iPad 打造速度超快的 HTML5 软件</title>
		<link>http://www.iinterest.net/2010/06/23/how-to-make-really-fast-html5-app-for-ipad/</link>
		<comments>http://www.iinterest.net/2010/06/23/how-to-make-really-fast-html5-app-for-ipad/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 05:35:24 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5相关]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=889</guid>
		<description><![CDATA[有一个为 iPad 设计的用来查时区的 HTML5 软件 everytimezone.com 最近引起了一些注意。它简单、到位，可以离线使用，并且速度极快。由于 HTML5 软件本质上只是一个网页，故不需要通过苹果的 App Store 商店发行，用户只要用 iPad 访问 everytimezone.com，然后将书签存到桌面，下一次打开就变成了一个与原生软件几乎无异的东西。everytimezone.com 的作者托马斯·富赫是资深 JavaScript 专家，也是 JavaScript 框架 Prototype 的核心开发者之一。他近日在博客上撰文传授了如何保证 HTML5 软件在 iPad 上飞速运行的七条秘诀，特翻译如下。—— 编者 一、少用图片 一开始，为了做出用来表示各个城市的每一天的那种渐变效果，我们用了一套相当复杂的 -webkit-gradient，结果发现这会令转译速度变得非常非常慢。-webkit-gradient 的工作方法是构建位图，对于浏览器的转译引擎来说，这和从外部加载图片（例如一张 PNG）是完全一样的。MobileSafari 显示图片速度之慢是出了名的（希望 4.0 对此有所改进），要解决这个问题，基本上只能不用图片和 -webkit-gradient。 我们最终把那些色彩条快用背景上的一个很大的 canvas 元素替代了。当你拖动游标线时，那些条块的颜色会发生变化，只有正在变化的部分才会被重新绘制。用 canvas &#8230; <a href="http://www.iinterest.net/2010/06/23/how-to-make-really-fast-html5-app-for-ipad/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>有一个为 iPad 设计的用来查时区的 HTML5 软件 everytimezone.com 最近引起了一些注意。它简单、到位，可以离线使用，并且速度极快。由于 HTML5 软件本质上只是一个网页，故不需要通过苹果的 App Store 商店发行，用户只要用 iPad 访问 everytimezone.com，然后将书签存到桌面，下一次打开就变成了一个与原生软件几乎无异的东西。everytimezone.com 的作者托马斯·富赫是资深 JavaScript 专家，也是 JavaScript 框架 Prototype 的核心开发者之一。他近日在博客上撰文传授了如何保证 HTML5 软件在 iPad 上飞速运行的七条秘诀，特翻译如下。—— 编者</p>
<p><strong>一、少用图片</strong></p>
<p>一开始，为了做出用来表示各个城市的每一天的那种渐变效果，我们用了一套相当复杂的 -webkit-gradient，结果发现这会令转译速度变得非常非常慢。-webkit-gradient 的工作方法是构建位图，对于浏览器的转译引擎来说，这和从外部加载图片（例如一张 PNG）是完全一样的。MobileSafari 显示图片速度之慢是出了名的（希望 4.0 对此有所改进），要解决这个问题，基本上只能不用图片和 -webkit-gradient。<br />
<span id="more-889"></span><br />
我们最终把那些色彩条快用背景上的一个很大的 canvas 元素替代了。当你拖动游标线时，那些条块的颜色会发生变化，只有正在变化的部分才会被重新绘制。用 canvas 时可以在某种程度上复用 -webkit-gradient，比如这样：</p>
<blockquote>
<div id="_mcePaste">// WebKit CSS gradient</div>
<div id="_mcePaste">-webkit-gradient(linear, left top, right top,</div>
<div id="_mcePaste">from(#4b4c4d),</div>
<div id="_mcePaste">color-stop(0.249, #4b4c4d),</div>
<div id="_mcePaste">color-stop(0.25, #575b5c),</div>
<div id="_mcePaste">color-stop(0.329, #575b5c),</div>
<div id="_mcePaste">color-stop(0.33, #6b7071),</div>
<div id="_mcePaste">color-stop(0.749, #6b7071),</div>
<div id="_mcePaste">color-stop(0.75, #575b5c),</div>
<div id="_mcePaste">color-stop(0.909, #575b5c),</div>
<div id="_mcePaste">color-stop(0.91, #4b4c4d),</div>
<div id="_mcePaste">to(#4b4c4d)</div>
<div id="_mcePaste">);</div>
<div id="_mcePaste">// canvas gradient</div>
<div id="_mcePaste">var gradient = $(&#8216;canvas&#8217;).getContext(“2d”).createLinearGradient(0,0,230,0);</div>
<div id="_mcePaste">gradient.addColorStop(0,&#8217;#4b4c4d&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.249,&#8217;#4b4c4d&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.25,&#8217;#575b5c&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.329,&#8217;#575b5c&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.33,&#8217;#6b7071&#8242;);</div>
<div id="_mcePaste">gradient.addColorStop(0.749,&#8217;#6b7071&#8242;);</div>
<div id="_mcePaste">gradient.addColorStop(0.75,&#8217;#575b5c&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.909,&#8217;#575b5c&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(0.91,&#8217;#4b4c4d&#8217;);</div>
<div id="_mcePaste">gradient.addColorStop(1,&#8217;#4b4c4d&#8217;);</div>
</blockquote>
<p><br/><br />
<strong>二、不要用 text-shadow 和 box-shadow</strong></p>
<p>这是速度变慢的另外一个重要因素。最好不要用这些 CSS 属性。</p>
<p><strong>三、硬件加速是很新的功能……而且也很多BUG</strong></p>
<p>在 Safari 上，只要使用 -webkit-transform 这个 CSS 属性就可以启用硬件加速了。（opacity 也行，不过缺点上面说过了。）</p>
<p>硬件加速有其局限，例如同时运行的动画数量是有限制的，如果超过了这个限制，动画就会闪烁，有时还会出错。不过如果轻度使用的话，效果会非常棒。</p>
<p><strong>四、尽可能地使用触控事件</strong></p>
<p>触控事件是个好选择，因为传统的 onClick 事件在 iPad 上用来会有点延迟。在 everytimezone.com 的源代码里有些小窍门，教你如何在使用触控事件的同时，也能够支持非触控设备上的浏览器：</p>
<blockquote><p>var supportsTouch = &#8216;createTouch&#8217; in document;<br />
element[supportsTouch ? 'ontouchmove' : 'onmousemove'] = function(event){<br />
var pageX = event.pageX;<br />
if (event.touches) pageX = event.touches[0].pageX;<br />
// &#8230;<br />
}</p></blockquote>
<p><strong>五、不要用 opacity</strong></p>
<p>因为某些原因，使用 opacity 这个 CSS 属性有时会干扰硬件加速。如果你感到速度变慢，但又看不出哪里出了问题的话，就检查一下有没有用到 opacity 吧。</p>
<p><strong>六、万事无捷径，请手写 JavaScript 和 CSS</strong></p>
<p>不要依赖框架或是网页标准狂热分子推荐给你的东西。我们这个例子里只有一个高度精简的 HTML 页面，CSS 都写在页面里，没用任何 JavaScript 框架，并尽量利用了目标平台（iPad）的特性，最终的结果就是一个几乎能够瞬间加载的苗条网页，而且缓存做得很好，离线使用也毫不失礼。没错，我们也可以选择用 JavaScript 和 CSS 框架，但有的时候少即多。（记住，各类框架所提供的那些对跨浏览器的支持你并非全都需要。）</p>
<blockquote><p>// mini-pico-tiny convenience micro-framework, ymmv<br />
function $(id){ return document.getElementById(id); }<br />
function html(id, html){ $(id).innerHTML = html; }<br />
function css(id, style){ $(id).style.cssText += &#8216;;&#8217;+style; }<br />
function anim(id, transform, opacity, dur){<br />
css(id, &#8216;-webkit-transition:-webkit-transform&#8217;+',opacity &#8216;+(dur||0.5)+&#8217;s,&#8217;+(dur||0.5)+&#8217;s;-webkit-transform:&#8217;+transform+&#8217;;opacity:&#8217;+(1||opacity));<br />
}</p></blockquote>
<p><strong>七、别用 translate，用 translate3d</strong></p>
<p>使用 -webkit-transform 时，记得用 translate3d(x,y,z) 语法，而不是 translate(x,y)。因为某种原因，后者无法支持硬件加速，至少在 iOS 3.x 上不行（不过在桌面版 Safari 里似乎没问题）。谢谢马提奥·斯宾内利指出这点。（也推荐大家看看他做的<a href="http://cubiq.org/iscroll" target="_blank"> iScroll</a>，里面有很多很棒的代码，也是演示如何为页面在移动版 WebKit 上的速度进行优化的好例子。）</p>
<p>转自<a href="https://apple4.us/2010/06/how-to-make-really-fast-html5-app-for-ipad.html" target="_blank">apple4.us</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2010/06/23/how-to-make-really-fast-html5-app-for-ipad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>让IE支持HTML5标签</title>
		<link>http://www.iinterest.net/2010/05/29/ie-html5-tag/</link>
		<comments>http://www.iinterest.net/2010/05/29/ie-html5-tag/#comments</comments>
		<pubDate>Sat, 29 May 2010 09:20:03 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[HTML5相关]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=864</guid>
		<description><![CDATA[HTML5的特性之一就是新增了语义的标签,比如 header, nav,section,aside, footer,audio,canvas等等.这些标签为设计者提供了更为灵活高效的布局方式.可惜目前的IE是不支持这些标签的&#8230;不过还是可以通过一些手段让IE支持部分标签. 先来看看一个HTML5的布局,由于IE无法识别新的语义化标签,所以样式表并没有起作用. &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34; /&#62; &#60;title&#62;HTML5 Lab - iinterest&#60;/title&#62; &#60;style type=&#34;text/css&#34;&#62; #wrapper{ width:600px; margin:0 auto;} header{ width:100%; height:100px; background:#C2E0EE;} article{ float:left; width:60%; height:300px; background:#8EC1DA;} section{ margin:20px; background:#FFF;} aside{ float:right; width:40%; height:300px; &#8230; <a href="http://www.iinterest.net/2010/05/29/ie-html5-tag/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>HTML5的特性之一就是新增了语义的标签,比如 header, nav,section,aside, footer,audio,canvas等等.这些标签为设计者提供了更为灵活高效的布局方式.可惜目前的IE是不支持这些标签的&#8230;不过还是可以通过一些手段让IE支持部分标签.</p>
<p>先来看看一个HTML5的布局,由于IE无法识别新的语义化标签,所以样式表并没有起作用.<br />
<span id="more-864"></span></p>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_dohNUG">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;HTML5 Lab - iinterest&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
#wrapper{ width:600px; margin:0 auto;}
header{ width:100%; height:100px; background:#C2E0EE;}
article{ float:left; width:60%; height:300px; background:#8EC1DA;}
	section{ margin:20px; background:#FFF;}
aside{ float:right; width:40%; height:300px; background:#688B9A;}
footer{ width:100%; height:100px; background:#CCC; clear:both;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapper&quot;&gt;
	&lt;header&gt;header&lt;/header&gt;
    &lt;article&gt;
    	&lt;section&gt;section&lt;/section&gt;
    &lt;/article&gt;
    &lt;aside&gt;aside&lt;/aside&gt;
    &lt;footer&gt;footer&lt;/footer&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_dohNUG');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_dohNUG');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>解决的方法就是用js来创建HTML5中新增的标签,因为此代码只提供给IE,所以加上条件注释:</p>
<blockquote>
<div id="_mcePaste">&lt;!&#8211;[if IE]&gt;</div>
<div id="_mcePaste">&lt;script&gt;</div>
<div id="_mcePaste">(function(){if(!/*@cc_on!@*/0)return;var e = “abbr,article,aside,audio,canvas,datalist,details,dialog,eventsource,figure,footer,header, hgroup,mark,menu,meter,nav,output,progress,section,time,video”.split(&#8216;,&#8217;),i=e.length;while(i&#8211;){document.createElement(e[i])}})()</div>
<div id="_mcePaste">&lt;/script&gt;</div>
<div id="_mcePaste">&lt;![endif]&#8211;&gt;</div>
</blockquote>
<p>这时可以看到例子中的样式表生效了,但布局效果却并不是预想的那样(可以对比支持HTML5的浏览器),原因就在于js所创建的元素默认都为行内元素&#8230;</p>
<p>所以最后还要为那些结构性的块级标签加上一个样式:</p>
<blockquote><p>article, aside, dialog, footer, header, section, footer, nav, figure {<br />
display: block;<br />
}</p></blockquote>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_In9pK5">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;HTML5 Lab - iinterest&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
#wrapper{ width:600px; margin:0 auto;}
header{ width:100%; height:100px; background:#C2E0EE;}
article{ float:left; width:60%; height:300px; background:#8EC1DA;}
	section{ margin:20px; background:#FFF;}
aside{ float:right; width:40%; height:300px; background:#688B9A;}
footer{ width:100%; height:100px; background:#CCC; clear:both;}
&lt;/style&gt;
&lt;!--[if IE]&gt;
&lt;script&gt;
(function(){if(!/*@cc_on!@*/0)return;var e = &quot;abbr,article,aside,audio,canvas,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video&quot;.split(','),i=e.length;while(i--){document.createElement(e[i])}})()
&lt;/script&gt;
&lt;style&gt;
article, aside, dialog, footer, header, section, footer, nav, figure {display: block;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapper&quot;&gt;
	&lt;header&gt;header&lt;/header&gt;
    &lt;article&gt;
    	&lt;section&gt;section&lt;/section&gt;
    &lt;/article&gt;
    &lt;aside&gt;aside&lt;/aside&gt;
    &lt;footer&gt;footer&lt;/footer&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_In9pK5');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_In9pK5');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>至此IE就可以正常的显示所定义的标签了,但也仅仅是正常显示,类似audio,canvas这些多媒体以及交互式标签的功能是无法实现的.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2010/05/29/ie-html5-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

