赞
踩
1. 新的Doctype
尽管使用<!DOCTYPE html>,即使浏览器不懂这句话也会按照标准模式去渲染
2. Figure元素
用<figure>和<figcaption>来语义化地表示带标题的图片
- <figure>
- <img src=”path/to/image” alt=”About image” />
- <figcaption>
- <p>This is an image of something interesting. </p>
- </figcaption>
- </figure>
3. 重新定义的<small>
一般在header里面用来将一组标题组合在一起,如
- <header>
- <hgroup>
- <h1> Recall Fan Page </h1>
- <h2> Only for people who want the memory of a lifetime. </h2>
- </hgroup>
- </header>
14. Required属性
- <input type=”text” name=”someInput” required>
- 或者
- <input type=”text” name=”someInput” required=”required”>
15. Autofocus属性
HTML5提供了<audio>标签,你不需要再按照第三方插件来渲染音频,大多数现代浏览器提供了对于HTML5 Audio的支持,不过目前仍旧需要提供一些兼容处理,如
- <audio autoplay=”autoplay” controls=”controls”>
- <source src=”file.ogg” /><!–FF–>
- <source src=”file.mp3″ /><!–Webkit–>
- <a href=”file.mp3″>Download this file.</a>
- </audio>
17. Video支持
和Audio很像,<video>标签提供了对于video的支持,由于HTML5文档并没有给video指定一个特定的编码,所以浏 览器去决定要支持哪些编码,导致了很多不一致。Safari和IE支持H.264编码的格式,Firefox和Opera支持Theora和Vorbis 编码的格式,当使用HTML5 video的时候,你必须都提供:
- <video controls preload>
- <source src=”cohagenPhoneCall.ogv” type=”video/ogg; codecs=’vorbis, theora’” />
- <source src=”cohagenPhoneCall.mp4″ type=”video/mp4; ’codecs=’avc1.42E01E, mp4a.40.2′” />
- <p> Your browser is old. <a href=”cohagenPhoneCall.mp4″>Download this video instead.</a> </p>
- </video>
18. 预加载视频
由于pattern属性,我们可以在你的markup里面直接使用正则表达式了
- <form action=”" method=”post”>
- <label for=”username”>Create a Username: </label>
- <input type=”text” name=”username” id=”username” placeholder=”4 <> 10″ pattern=”[A-Za-z]{4,10}” autofocus required>
- <button type=”submit”>Go </button>
- </form>
21. 检测属性支持
CSS中使用:
- h1:hover:after {
- content: attr(data-hover-response);
- color: black;
- position: absolute;
- left: 0;
<h1 data-hover-response=”I Said Don’t Touch Me!”> Don’t Touch Me </h1>
27. Output元素
可以使用css的:before和:after来显示min和max的值
<input type=”range” name=”range” min=”0″ max=”10″ step=”1″ value=”">
- input[type=range]:before { content: attr(min); padding-right: 5px;
- }
- input[type=range]:after { content: attr(max); padding-left: 5px;}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。