Skip to main content

The HTML Living Standard

Every element you have used in this course, from p to form, is defined in one place: a long, carefully written document called the HTML Standard. It decides what each element means, what it may contain, and exactly how a browser must read your markup. Knowing a little about this document makes you a calmer, more confident developer, because "how does HTML work?" has a real, public answer.

What You Will Learn​

  • A short history of HTML, and why "HTML5" is not the end of the story
  • Who maintains the standard, and what "living" means
  • How a new feature gets into HTML
  • How the parser handles broken markup the same way in every browser
  • How to read an element's entry in the specification
  • How the standard, MDN, and validators fit together

The Big Idea​

HTML used to be released in numbered versions. Today there is one standard that is edited continuously, and browsers follow it. You do not "upgrade to a new HTML". You learn new features as browsers support them, on top of everything that still works.

http://127.0.0.1:5500/index.html

Loading the parser lab...

A Short History​

WhenWhat happened
Early 1990sTim Berners-Lee describes the first version of HTML for the early web
1995HTML 2.0 is published by the IETF, the first formal standard
1997HTML 3.2 from the W3C. HTML 4.01 follows in 1999
2000XHTML 1.0, a stricter, XML-based version of HTML, is published
2004Browser makers (Apple, Mozilla, and Opera) form the WHATWG, because they want HTML to grow to fit real web applications
Around 2011The WHATWG drops the "5" and calls its document the HTML Living Standard
2014The W3C publishes HTML5 as a finished recommendation
2019The W3C and WHATWG agree that the WHATWG's living standard is the single, official HTML specification

So "HTML5" was a real milestone, and it is still a handy word for "modern HTML". But there is no HTML6 planned. The standard keeps changing in small steps.

info

The WHATWG is a community of browser makers and others. Its steering group includes Apple, Google, Mozilla, and Microsoft. Anyone can suggest a change in the open, on the project's public GitHub repository.

What "Living" Means for You​

  • No version numbers to wait for. New features appear in the standard, then in browsers, one at a time.
  • Backward compatibility is a rule. Browsers keep supporting old pages. A page written long ago still works, so your skills do not expire.
  • Support differs by browser and version. A feature can be in the standard and still be missing in some browsers. That is why you check support, as the Modern HTML overview explains.
  • The document changes. When you read a tutorial, an article, or this one, ask how old it is.

How a Feature Gets Into HTML​

The exact process has details, but the broad path is:

  1. A problem is noticed. For example, "everyone builds pop-ups from scratch, and gets focus wrong".
  2. An idea is discussed in public, often in an incubation group or on GitHub, with browser makers, developers, and accessibility experts.
  3. A specification is written. It says exactly how the feature must behave, including edge cases and errors.
  4. Tests are written. A shared test suite called web-platform-tests checks that every browser behaves the same way.
  5. Browsers implement it. Usually the standard needs more than one browser engine to be interested before a change is accepted.
  6. Documentation is written, for example on MDN, and the feature gets a Baseline label as support grows.
  7. Developers use it, with fallbacks while support is still spreading.

That is why features such as dialog and the popover attribute took time to be ready: each step needs several groups to agree.

What Is in the Standard​

The HTML Standard is much more than a list of tags. It also defines:

  • Every element, with its meaning, where it may appear, what it may contain, and its attributes.
  • How browsers parse HTML, step by step, including what to do with mistakes.
  • Web APIs that belong to HTML, such as postMessage, web storage, web workers, the history API, and drag and drop.
  • Rules for forms, media, canvas, and embedding, and for how pages load.

It does not define everything on a web page. Other standards cover the rest:

TopicWho defines it
HTML elements, parsing, and many web APIsWHATWG HTML Standard
The DOM, URLs, and network requests (fetch)Other WHATWG standards
CSSThe W3C CSS Working Group
JavaScriptEcma International, TC39 (ECMAScript)
Accessibility roles and attributes (ARIA)The W3C

The Parser: Forgiving, but Exactly Defined​

When you forget a closing tag, the browser does not show an error. It repairs the markup. In older days, every browser repaired it a little differently, which was a big source of bugs. The modern standard defines the repair rules precisely, so every browser builds the same page from the same markup.

Open the Parser Lab tab and try the buttons:

  • Unclosed paragraphs: the second p closes the first.
  • Table without tbody: the parser adds a tbody for you.
  • Crossed tags: the parser rearranges b and i so the page still has a valid tree.
  • A div inside a p: a p cannot hold a div, so the parser closes the p first.
  • Bare text: the parser adds html, head, and body.

The lab tells you which structural elements the parser added. This is why a page can look right in a browser and still be invalid HTML, and why it is worth validating your markup.

warning

The parser's repairs are about safety nets, not about being sloppy on purpose. Do not rely on repairs. Write correct markup, and check the result in DevTools. Differences between how a sanitiser and a browser parse markup have caused real security bugs, so never write your own HTML cleaner with regular expressions. Use the browser's parser, or a maintained library, as covered in XSS Basics.

Reading an Element's Entry in the Standard​

You do not need to read the standard from start to finish. But once you know its layout, you can look up any element in a few seconds. Each element's entry has the same parts:

PartWhat it tells you
CategoriesGroups the element belongs to, such as flow content, phrasing content, or interactive content
Contexts in which this element can be usedWhere the element may appear
Content modelWhat the element may contain
Content attributesThe attributes it supports
Accessibility considerationsNotes on roles and use by assistive technology
DOM interfaceThe JavaScript object and its properties and methods

The content model is the part that settles most arguments. Open the Content Model Quiz tab, and decide whether each snippet is valid. Then, on the specification's page for each element, read its content model line to confirm your answer.

Words you will meet​

  • Flow content: most elements that can appear in the body, such as p, div, and section.
  • Phrasing content: the text and inline elements inside a paragraph, such as strong, a, and span.
  • Interactive content: elements a visitor can interact with, such as a, button, and input.
  • Transparent: the element takes whatever its parent allows, as a does.

The Standard, MDN, and Validators​

ToolBest for
The HTML Standard (html.spec.whatwg.org)The final answer on exact behaviour. Precise, but written for implementers
MDN Web DocsFriendly explanations, examples, and browser support tables
A validator, such as the Nu Html CheckerChecking your own pages against the standard's rules
DevToolsSeeing the page the browser actually built

A good habit: use MDN to learn, the standard to settle a disagreement, and a validator to check your work.

Obsolete Features​

Some features from the past, such as font, center, marquee, and presentational attributes like align, are obsolete. The standard says authors must not use them, but browsers still have to support them so old pages do not break. For new pages, use the modern replacement: CSS for looks, and meaningful elements for structure.

Checking Your Setup​

  1. Run your page through the Nu Html Checker (the validator at validator.w3.org/nu), and read the messages. Each cites a rule from the standard.
  2. Compare View Source with the Elements panel in DevTools. Elements shows the page the parser built, with repairs applied.
  3. For any element you are unsure about, read its content model in the specification.
  4. Check the date on any tutorial. If it is old, confirm the details on MDN.
  5. For a new feature, check the Baseline label and the compatibility table on MDN.

Best Practices​

  1. Write valid markup, and let the parser's repairs be a safety net only.
  2. Validate your pages now and then, especially after big changes.
  3. Use the standard to settle questions, and MDN to learn.
  4. Check support before using a new feature.
  5. Prefer current elements and CSS over obsolete ones.
  6. Keep the doctype <!DOCTYPE html> at the top of every page.
  7. Check old advice against current sources.
  8. Do not write your own HTML sanitiser.

Quick Checklist​

  • My pages begin with <!DOCTYPE html>
  • My markup passes the validator, or I understand each message
  • I check content models for elements I am unsure about
  • I compare View Source with the Elements panel when something looks odd
  • I check browser support before using a new feature
  • I use no obsolete elements or attributes in new work

Security and Privacy Notes​

  • Parsing differences can be exploited. Attackers sometimes rely on markup that two parsers read differently. Always sanitise with the same kind of parser the browser uses, or a maintained library. See XSS Basics.
  • Do not paste private markup into online tools. A validator or playground that is a website receives what you send. Use made-up examples, or run a checker locally.
  • A forgiving parser is not a safe parser. Repairs help layout, not security.

Global Audience Notes​

  • The standard is written in English, and most translations lag behind it. MDN has many translations, but they can be out of date, so check the date.
  • Languages and scripts are part of HTML. Attributes like lang and dir, covered in earlier lessons, are in the standard, and matter for screen readers, fonts, and right-to-left text.
  • Older browsers and devices exist everywhere. A living standard means different visitors have different features, so build a solid base.

Common Mistakes to Avoid​

  1. Treating "HTML5" as the latest version, and waiting for HTML6.
  2. Relying on the parser's repairs instead of writing valid markup.
  3. Trusting an old tutorial without checking MDN.
  4. Confusing View Source with what the browser actually built.
  5. Using obsolete elements because they still work.
  6. Skipping the doctype.
  7. Assuming a feature in the standard works everywhere.
  8. Writing a regular expression to clean HTML.
  9. Ignoring validator messages, instead of reading the rule behind them.
  10. Mixing up the standards, and looking for CSS rules in the HTML Standard.

Practice Time​

  1. In the Parser Lab, click each sample button. Which ones make the parser add elements? Which structural elements does it add?
  2. Type a paragraph with no closing tag followed by a ul. What does the parser do?
  3. Type <p>One <div>Two</div></p>. Where does the page end the p?
  4. Complete the Content Model Quiz. Which answer surprised you?
  5. Open the Nu Html Checker, and paste a small page of your own (without anything private). Read the first three messages.
  6. Compare View Source and the Elements panel on a page with a table. What differs?
  7. Look up the content model of button on MDN or in the standard. Write it in your own words.
  8. Bonus: find the oldest tutorial you can on a topic, and list what is out of date.

Quick Recap​

Click a question to check your answer.

1. What is the HTML Living Standard?

The single, continuously updated specification of HTML, maintained by the WHATWG with browser makers. It replaces numbered versions.

2. Will there be an HTML6?

No version is planned. HTML changes in small steps instead, and features arrive in browsers one at a time.

3. How does a feature get into HTML?

It is proposed and discussed in public, specified in detail, tested with shared tests, implemented by browsers, and then documented. A change normally needs interest from more than one browser engine.

4. Why does broken markup look the same in every browser?

The standard defines the parser's repair rules step by step, so every browser builds the same page from the same input.

5. What is a content model?

The rule that says what an element may contain. It settles whether a snippet is valid, such as whether a p may hold a div.

6. When do you use MDN, the standard, and a validator?

MDN to learn and check support, the standard to settle exact behaviour, and a validator to check your own pages.

Key Takeaways​

  • HTML is one living standard, edited continuously by the WHATWG with browser makers.
  • There are no new numbered versions. Features arrive and spread over time.
  • The parser is forgiving and exactly defined. Still, write valid markup.
  • Content models explain what each element may contain.
  • MDN teaches, the standard decides, validators check.
  • Old features still work, but avoid them in new pages.
  • Never rely on your own regular expressions to clean HTML.

Next up: Modern HTML Features, where you will take a guided tour of newer attributes and elements, and learn to judge which ones are ready for your site.