Pengenalan HTML5

每一章中的 HTML5 示例

实例

!DOCTYPE html
<html>
<body>
<video width="420" controls>
  <source src="mov_bbb.mp4" type="video/mp4">
  <source src="mov_bbb.ogg" type="video/ogg">
 Your browser does not support the video tag.
</video>
</body>
</html>

亲自试一试

点击“亲自试一试”来查看该例如何运行。

什么是 HTML5?

HTML5 是最新的 HTML 标准。

HTML5 是专门为承载丰富的 web 内容而设计的,并且无需额外插件。

HTML5 拥有新的语义、图形以及多媒体元素。

HTML5 提供的新元素和新的 API 简化了 web 应用程序的搭建。

HTML5 是跨平台的,被设计为在不同类型的硬件(PC、平板、手机、电视机等等)之上运行。

注释:在下面的章节中,您将学到如何“帮助”老版本的浏览器处理 HTML5。

HTML5 中的新内容?

HTML5 的新的文档类型(DOCTYPE)声明非常简单:

!DOCTYPE html
The new character encoding (charset) declaration is also very simple:
<meta charset="UTF-8">

HTML5 实例:

!DOCTYPE html
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Content of the document......
</body>
</html>

注释:HTML5 中默认的字符编码是 UTF-8。

HTML5 - 新的属性语法

HTML5 标准允许 4 种不同的属性语法。

本例演示在 标签中使用的不同语法:

类型 示例
Empty
Unquoted
Double-quoted
Single-quoted

在 HTML5 标准中,根据对属性的需求,可能会用到所有 4 种语法。

HTML5 - 新特性

HTML5 的一些最有趣的新特性:

  • 新的语义元素,比如
    ,
    ,
    , and
  • 新的表单控件,比如数字、日期、时间、日历和滑块。
  • 强大的图像支持(借由
  • 强大的多媒体支持(借由
  • 强大的新 API,比如用本地存储取代 cookie。

HTML5 - 被删元素

以下 HTML 4.01 元素已从 HTML5 中删除:

  • </li> <li><strike></li> <li><tt></li> </ul> </div> <div class="prenextnav"> <ul> <li> 上一页 <a href="/ha/html/html_youtube.html" title="Video YouTube HTML">HTML YouTube</a></li> <li> 下一页 <a href="/ha/html/html5_browsers.html" title="Dukungan Browser HTML5">HTML5 支持</a></li> </ul> </div><div style="background-color:#fcfdf8; padding:0;"> </div> </div> <!-- maincontent end --> <div id="sidebar"> <div><h3><center> 工具箱 </center><h3> <h5 id="tools_reference"><a href="/ha/tags/index.html">HTML 参考手册</a></h5> <h5 id="tools_example"><a href="/ha/html/html_examples.html">Contoh HTML</a></h5> <h5 id="tools_quiz"><a href="/ha/html/html_quiz.html">Ujian HTML</a></h5> </div> <div><h3><center> 赞助商链接 </center><h3> <div id="sbtg"> <script src="/myjs/zzsr.js"></script> </div> </div> </div> <div id="footer"> <p id="p1"> CodeW3C.com 提供的内容仅用于培训和测试,不保证内容的正确性。通过使用本站内容随之而来的风险与本站无关。版权所有,保留一切权利。 </p> <p id="p2"> <a href="/ha/about/index.html" title="Hanyar CodeW3C.com">Hanyar CodeW3C.com</a> <a href="/ha/about/about_helping.html" title="Nasara CodeW3C.com">Nasara CodeW3C.com</a> <a href="/ha/about/about_use.html" title="Hanyar Kwararrufin">Kwararrufin Dukiya</a> <a href="/ha/about/about_privacy.html" title="Hanyar Kwararrufin Ilimi">Kwararrufin Ilimi</a> <a href="http://www.comfortsoftwaregroup.com/" target="_blank"><img src="/comfortsoftwaregroup.png"></a> <a href="http://www.ce4e.com/" target="_blank"><img src="/poweredby.png" alt="Mantada da Ce4e.com"></a> </p> </div> </div> <!-- wrapper end --> <script src="/myjs/tongji.js"></script> </body> </html>