HTML5 introduces elements and attributes that reflect typical usage on modern websites. Some of them are semantic replacements for common uses of generic block (
<div>
) and inline (<span>
) elements, for example <nav>
(website navigation block), <footer>
(usually referring to bottom of web page or to last lines of HTML code), or <audio>
and <video>
instead of<object>
. Some deprecated elements from HTML 4.01 have been dropped, including purely presentational elements such as <font>
and <center>
, whose effects have long been superseded by the much more powerful Cascading Style Sheets. There is also a renewed emphasis on the importance of DOM scripting (e.g., JavaScript) in Web behavior.
The HTML5 syntax is no longer based on SGML despite the similarity of its markup. It has, however, been designed to be backward compatible with common parsing of older versions of HTML. It comes with a new introductory line that looks like an SGML document type declaration,
<!DOCTYPE html>
, which triggers the standards-compliant rendering mode. As of 5 January 2009, HTML5 also includes Web Forms 2.0, a previously separate WHATWG specification.New APIs
In addition to specifying markup, HTML5 specifies scripting application programming interfaces (APIs) that can be used with JavaScript. Existing document object model (DOM) interfaces are extended and de facto features documented. There are also new APIs, such as:
- The canvas element for immediate mode 2D drawing. See Canvas 2D API Specification 1.0 specification
- Timed media playback
- Offline Web Applications
- Document editing
- Drag-and-drop
- Cross-document messaging
- Browser history management
- MIME type and protocol handler registration
- Microdata
- Web Storage, a key-value pair storage framework that provides behaviour similar to cookies but with larger storage capacity and improved API.
Not all of the above technologies are included in the W3C HTML5 specification, though they are in the WHATWG HTML specification. Some related technologies, which are not part of either the W3C HTML5 or the WHATWG HTML specification, are as follows. The W3C publishes specifications for these separately:
- Geolocation
- Web SQL Database, a local SQL Database (no longer maintained).
- The Indexed Database API, an indexed hierarchical key-value store (formerly WebSimpleDB).
- HTML5 File API, handles file uploads and file manipulation.
- Directories and System, an API intended to satisfy client-side-storage use cases not well served by databases.
- File Writer, an API for writing to files from web applications.
- Web Audio API, a high-level JavaScript API for processing and synthesizing audio in web applications.