Html5 简明教程

HTML5 - Overview

HTML5 是 HTML 标准的下一个主要修订版,取代了 HTML 4.01、XHTML 1.0 和 XHTML 1.1。HTML5 是一种在万维网上构建和展示内容的标准。

HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.

HTML5 是万维网联盟 (W3C) 和网络超文本应用程序技术工作组 (WHATWG) 共同合作的成果。

HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).

新的标准融入了视频播放和拖放等功能,这些功能之前依赖于诸如 Adobe Flash、Microsoft Silverlight 和 Google Gears 等第三方浏览器插件。

The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.

Browser Support

最新版本的 Apple Safari、Google Chrome、Mozilla Firefox 和 Opera 都支持很多 HTML5 功能,而 Internet Explorer 9.0 也会支持一些 HTML5 功能。

The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionality.

预装在 iPhone、iPad 和 Android 手机上的移动网络浏览器都对 HTML5 有着很好的支持。

The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.

New Features

HTML5 引入了能在构建现代网站中帮助你的大量新元素和属性。下面是一组 HTML5 中引入的一些最突出的功能。

HTML5 introduces a number of new elements and attributes that can help you in building modern websites. Here is a set of some of the most prominent features introduced in HTML5.

  1. New Semantic Elements − These are like <header>, <footer>, and <section>.

  2. Forms 2.0 − Improvements to HTML web forms where new attributes have been introduced for <input> tag.

  3. Persistent Local Storage − To achieve without resorting to third-party plugins.

  4. WebSocket − A next-generation bidirectional communication technology for web applications.

  5. Server-Sent Events − HTML5 introduces events which flow from web server to the web browsers and they are called Server-Sent Events (SSE).

  6. Canvas − This supports a two-dimensional drawing surface that you can program with JavaScript.

  7. Audio & Video − You can embed audio or video on your webpages without resorting to third-party plugins.

  8. Geolocation − Now visitors can choose to share their physical location with your web application.

  9. Microdata − This lets you create your own vocabularies beyond HTML5 and extend your web pages with custom semantics.

  10. Drag and drop − Drag and drop the items from one location to another location on the same webpage.

Backward Compatibility

HTML5 尽可能设计为向后兼容现有网络浏览器。新功能建立在已有功能的基础上,允许您为较旧的浏览器提供备用内容。

HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. Its new features have been built on existing features and allow you to provide fallback content for older browsers.

建议使用几行 JavaScript 来检测对各个 HTML5 功能的支持。

It is suggested to detect support for individual HTML5 features using a few lines of JavaScript.

如果您不熟悉任何以前版本的 HTML,我建议您在探索 HTML5 的功能之前先浏览我们的 HTML Tutorial

If you are not familiar with any previous version of HTML, I would recommend that you go through our HTML Tutorial before exploring the features of HTML5.