Coding Standards

HTML & Markup Standards

Foundational

HTML is the foundation everything else sits on. Getting the markup right gives you accessibility, SEO, and robustness almost for free. Use semantic elements for what they mean, keep documents valid and well-structured, and let HTML do its job instead of rebuilding it with divs and JavaScript. Pairs with the Accessibility, React, Blazor, and CSS standards.

The biggest HTML mistake is ignoring semantics: using <div> and <span> for everything and adding behaviour on top, instead of using the element that already means what you want. Browsers, assistive technology, and search engines understand semantic HTML with no extra work. Non-semantic markup throws that away and forces you to rebuild it, often badly and without accessibility.

Whether you write HTML directly or through JSX or Razor, these rules apply to the markup you produce.

Use semantic elements

Div soup <div class="btn" onclick="submit()">Submit</div>
<div class="title-big">Account</div>
<div><div>Email</div><input></div>

None of this works with the keyboard or is understood by a screen reader: a fake button, a heading that is just styled text, and an unlabelled input. Accessibility, SEO, and robustness are all thrown away.

Semantic markup <button type="submit">Submit</button>
<h1>Account</h1>
<label for="email">Email</label><input id="email" type="email">

Real elements are focusable, operable, announced correctly, and styleable. The right semantics give accessibility and robustness for free.

Structure & validity

Accessibility & ARIA

Safety & performance

Self-review checklist

Why it matters: Semantic, valid HTML gives accessibility, SEO, and robustness almost for free. A pile of divs throws all that away and has to rebuild it, usually breaking keyboard and screen-reader users along the way. Good markup is the cheapest accessibility and quality win there is, and it is the foundation our CSS and components depend on.