HTML5 Overview
HTML5 is the next major version of the HTML standard, replacing HTML 4.01, XHTML 1.0 and XHTML 1.1. HTML5 is also a standard for structuring and presenting content on the World Wide Web.
HTML5 is the product of cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Technology Working Group (WHATWG).
This new standard adds features such as video playback and drag-and-drop, which in the past relied on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight and Google Gears.
Browser support
The latest version of Apple Safari, Mozilla FireFox and Opera support most HTML5 features, and IE9 also supports some HTML5 features.
Mobile browsers pre-installed on iPhones, iPads and Android phones all have good support for HTML5.
New Features
HTML5 introduces many new elements and attributes to help us build modern websites. Here are the main features introduced by HTML5:
New semantic elements: such as
Forms 2.0: Improvements to HTML web forms, introducing some new attributes for the tag.
Persistent local storage: In order not to be implemented through third-party plug-ins.
WebSocket: The next generation of two-way communication technology for web applications.
Server push events: HTML5 introduces events from the web server to the web browser, also known as server push events (SSE).
Canvas: Supports programmatic 2D drawing using JavaScript.
Audio and Video: Embed audio or video in web pages without resorting to third-party plug-ins.
Geolocation: Users can choose to share their geographical location with our web pages.
Microdata: Allows us to create custom vocabularies outside of HTML5 and extend web pages with custom semantics.
Drag and drop: Drag and drop items on the same web page from one location to another.
Backwards Compatibility
HTML5 is designed to be as backwards compatible with existing browsers as possible. New features build on existing features and allow us to provide fallback content for older browsers.
It is recommended to use a small amount of JavaScript code to detect support for individual HTML5 features.
HTML5 syntax
HTML5 has "its own" HTML syntax that is compatible with HTML 4 and XHTML1 documents already published on the web, but is not compatible with the more complex SGML features in HTML 4.
HTML5 does not have the syntax rules in XHTML that require lowercase tag names, quote attributes, attributes must have a value, and all empty elements must be closed.
But HTML5 is more flexible and supports the following forms:
Capitalize tag names.
Double quotes for attributes are optional.
Attribute value is optional.
Closing empty elements is optional.
DOCTYPE
In old versions of HTML, DOCTYPE is very long because the HTML language is based on SGML and needs to reference a DTD.
HTML5 authors can use a simple syntax to specify a DOCTYPE of the form:
The above syntax is not case sensitive.
Character Encoding
HTML5 authors can specify the character encoding using a simple syntax as follows:
The above syntax is not case sensitive.