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.
- Parser Lab
- Content Model Quiz
- Where Rules Live
Loading the parser lab...
Is each snippet valid HTML according to the content model of its elements?
<ul><li>One</li><li>Two</li></ul><ul><div>One</div></ul><p>Hello <strong>world</strong></p><p>Intro <div>A box</div></p><a href="/x"><div>Card</div></a><button><a href="/x">Go</a></button><details><p>Text</p><summary>Title</summary></details><table><tr><td>Cell</td></tr></table><table><td>Cell</td></table><!-- Rules from the HTML Standard, seen in everyday markup -->
<!-- 1. The doctype puts the browser in standards mode -->
<!DOCTYPE html>
<!-- 2. Content models: a ul may hold li, not div -->
<ul>
<li>Valid</li>
</ul>
<!-- 3. The parser repairs this the same way in every browser -->
<p>First
<p>Second
A Short Historyβ
| When | What happened |
|---|---|
| Early 1990s | Tim Berners-Lee describes the first version of HTML for the early web |
| 1995 | HTML 2.0 is published by the IETF, the first formal standard |
| 1997 | HTML 3.2 from the W3C. HTML 4.01 follows in 1999 |
| 2000 | XHTML 1.0, a stricter, XML-based version of HTML, is published |
| 2004 | Browser makers (Apple, Mozilla, and Opera) form the WHATWG, because they want HTML to grow to fit real web applications |
| Around 2011 | The WHATWG drops the "5" and calls its document the HTML Living Standard |
| 2014 | The W3C publishes HTML5 as a finished recommendation |
| 2019 | The 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.
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:
- A problem is noticed. For example, "everyone builds pop-ups from scratch, and gets focus wrong".
- An idea is discussed in public, often in an incubation group or on GitHub, with browser makers, developers, and accessibility experts.
- A specification is written. It says exactly how the feature must behave, including edge cases and errors.
- Tests are written. A shared test suite called web-platform-tests checks that every browser behaves the same way.
- Browsers implement it. Usually the standard needs more than one browser engine to be interested before a change is accepted.
- Documentation is written, for example on MDN, and the feature gets a Baseline label as support grows.
- 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:
| Topic | Who defines it |
|---|---|
| HTML elements, parsing, and many web APIs | WHATWG HTML Standard |
The DOM, URLs, and network requests (fetch) | Other WHATWG standards |
| CSS | The W3C CSS Working Group |
| JavaScript | Ecma 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
pcloses the first. - Table without
tbody: the parser adds atbodyfor you. - Crossed tags: the parser rearranges
bandiso the page still has a valid tree. - A div inside a p: a
pcannot hold adiv, so the parser closes thepfirst. - Bare text: the parser adds
html,head, andbody.
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.
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:
| Part | What it tells you |
|---|---|
| Categories | Groups the element belongs to, such as flow content, phrasing content, or interactive content |
| Contexts in which this element can be used | Where the element may appear |
| Content model | What the element may contain |
| Content attributes | The attributes it supports |
| Accessibility considerations | Notes on roles and use by assistive technology |
| DOM interface | The 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, andsection. - Phrasing content: the text and inline elements inside a paragraph, such as
strong,a, andspan. - Interactive content: elements a visitor can interact with, such as
a,button, andinput. - Transparent: the element takes whatever its parent allows, as
adoes.
The Standard, MDN, and Validatorsβ
| Tool | Best for |
|---|---|
| The HTML Standard (html.spec.whatwg.org) | The final answer on exact behaviour. Precise, but written for implementers |
| MDN Web Docs | Friendly explanations, examples, and browser support tables |
| A validator, such as the Nu Html Checker | Checking your own pages against the standard's rules |
| DevTools | Seeing 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β
- 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.
- Compare View Source with the Elements panel in DevTools. Elements shows the page the parser built, with repairs applied.
- For any element you are unsure about, read its content model in the specification.
- Check the date on any tutorial. If it is old, confirm the details on MDN.
- For a new feature, check the Baseline label and the compatibility table on MDN.
Best Practicesβ
- Write valid markup, and let the parser's repairs be a safety net only.
- Validate your pages now and then, especially after big changes.
- Use the standard to settle questions, and MDN to learn.
- Check support before using a new feature.
- Prefer current elements and CSS over obsolete ones.
- Keep the doctype
<!DOCTYPE html>at the top of every page. - Check old advice against current sources.
- 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
langanddir, 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β
- Treating "HTML5" as the latest version, and waiting for HTML6.
- Relying on the parser's repairs instead of writing valid markup.
- Trusting an old tutorial without checking MDN.
- Confusing View Source with what the browser actually built.
- Using obsolete elements because they still work.
- Skipping the doctype.
- Assuming a feature in the standard works everywhere.
- Writing a regular expression to clean HTML.
- Ignoring validator messages, instead of reading the rule behind them.
- Mixing up the standards, and looking for CSS rules in the HTML Standard.
Practice Timeβ
- In the Parser Lab, click each sample button. Which ones make the parser add elements? Which structural elements does it add?
- Type a paragraph with no closing tag followed by a
ul. What does the parser do? - Type
<p>One <div>Two</div></p>. Where does the page end thep? - Complete the Content Model Quiz. Which answer surprised you?
- Open the Nu Html Checker, and paste a small page of your own (without anything private). Read the first three messages.
- Compare View Source and the Elements panel on a page with a table. What differs?
- Look up the content model of
buttonon MDN or in the standard. Write it in your own words. - 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.