HTML5

On this page 7

HTML5 is the fifth major generation of HTML, the markup language of the web, and the name for the set of features that turned HTML from a document format into a platform for web applications. It introduced semantic structural elements, native audio and video, new form controls, the canvas element and a precisely defined parsing algorithm, together with a family of JavaScript APIs.

Today the term is partly historical. Since 2019 there is a single HTML Living Standard, maintained by the WHATWG and continuously updated, so the web no longer has numbered HTML versions. In everyday web practice, HTML5 still means modern, standards-based HTML as opposed to HTML 4.01 and XHTML 1.0.

From HTML 4 to the HTML Living Standard

HTML5 emerged from a split in the standards community. The W3C had moved toward XHTML 2, a strict XML-based language that was not backward compatible, while browser vendors wanted to evolve HTML for applications. In 2004 Apple, Mozilla and Opera formed the WHATWG, whose work became the basis of HTML5.

YearMilestoneSignificance
1999HTML 4.01 RecommendationLast version before HTML5; presentational markup still common
2000XHTML 1.0HTML reformulated as XML with strict syntax
2004WHATWG foundedBrowser vendors start Web Applications 1.0
2008First HTML5 public draft at W3CW3C adopts the WHATWG direction
2014HTML5 W3C RecommendationFeature set formally stabilized
2019W3C and WHATWG agreementLiving Standard becomes the single HTML specification
Milestones in the evolution of HTML

The practical effect is that browsers implement features, not versions. Developers check whether a specific element or API is supported in their target browsers instead of asking whether a browser supports HTML5 as a whole.

What HTML5 added

HTML5 added capabilities that previously required plugins, scripts or non-standard markup. The table groups the most important additions by purpose.

Feature groupExamplesWhat it replaced
Semantic structureheader, nav, main, article, section, aside, footerGeneric div elements with class names
Native mediaaudio, video, track for captionsFlash and other browser plugins
Graphicscanvas element, inline SVG in HTMLPlugin-based drawing and image hacks
FormsInput types email, date, range; required, patternJavaScript-only validation and widgets
Storage and offlineWeb Storage, IndexedDBCookies used as data stores
CommunicationWebSocket, postMessage, server-sent eventsRepeated polling and workarounds
Major feature groups introduced with HTML5

HTML5 also simplified the document skeleton. The long doctype declarations of HTML 4 were reduced to a short doctype that names only html, with no DTD reference, and character encoding became a single meta charset declaration, usually set to UTF-8.

Parsing and error handling

One of the most important but least visible changes is the standardized parsing algorithm. Earlier specifications described valid markup but not how browsers should treat invalid markup, so each browser repaired broken pages differently.

HTML5 defines exactly how any byte stream becomes a DOM tree, including how unclosed tags, misnested elements and stray characters are handled. As a result, the same page produces the same DOM in every conforming browser, which made cross-browser behavior far more predictable and allowed validators and tools to match browser behavior.

This tolerant model differs sharply from XHTML served as XML, where a single well-formedness error stops rendering. HTML5 kept the forgiving approach because most of the existing web would otherwise break.

HTML5 compared with earlier markup

Comparing HTML5 with its predecessors clarifies which habits are obsolete. Presentational elements such as font and center are no longer conforming, because styling belongs in CSS.

AspectHTML 4.01XHTML 1.0HTML5
Syntax rulesSGML-based, lenientXML, strict well-formednessOwn syntax, defined error recovery
DoctypeLong, with DTD referenceLong, with DTD referenceShort, no DTD
Structural semanticsGeneric divisionsGeneric divisionsDedicated sectioning elements
MediaPlugins requiredPlugins requiredNative audio and video
Form validationScripts onlyScripts onlyBuilt-in constraint validation
VersioningFixed versionFixed versionContinuously updated standard
HTML 4.01, XHTML 1.0 and HTML5 compared

Common misconceptions and pitfalls

Because HTML5 was also used as a marketing label, the term attracted several misunderstandings that still affect projects and job descriptions.

  • HTML5 is not CSS3 or JavaScript. The label was often stretched to cover all modern web technology, but HTML defines structure and meaning only.
  • New elements are not automatically accessible. Using section or nav helps assistive technology only when they reflect the real structure of the page.
  • Native form validation is not security. Browser checks improve usability, but every value must still be validated on the server.
  • Wrapping everything in `section` is not semantic HTML. Generic containers without a heading or meaning should remain div elements.
  • Checking for HTML5 support is outdated. Feature detection for specific APIs is the reliable approach.

In everyday language

HTML5 is the modern version of the language that describes web pages. It tells the browser what each part of a page is: a heading, a menu, an article, a video or a form.

Before HTML5, playing a video or drawing an animation in a browser often needed extra software such as a plugin. HTML5 built those abilities into the browser itself, so websites became faster, safer and able to work on phones as well as computers.

Seen in the real world

A regional news publisher still runs article pages built around 2009 on nested tables, a Flash video player and a registration form validated by a large custom script. Mobile readers cannot play the videos, and screen reader users report that they cannot find where the article starts.

Developers rebuild the template with semantic HTML5 elements, wrapping navigation in nav, the story in article inside main and related links in aside. Videos move to the native video element with a caption track, and the form uses type="email" and the required attribute with server-side checks kept in place.

The new pages play video on every device without plugins, screen reader users can jump directly to the main content, and about half of the old validation script is removed because the browser now handles basic input checks.