HTML
Progressive lessons on document structure, semantics, forms, accessibility, media, and browser APIs. · 30 lessons · click a card to expand
Web Stack & Parsing
3 items01How the web stack fits together
Understanding this separation helps you write better markup. If you use a <button> for navigation, CSS can style it like a link, but assistive technology still knows it is a button. If you hide important text inside a background image, HTML cannot recover that meaning for search engines or screen readers. Start every feature by asking: "What belongs in HTML, what in CSS, and what in JS?"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Stack Demo</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<button id="greet">Say hello</button>
<script src="app.js"></script>
</body>
</html>In this skeleton, HTML declares a button; CSS in styles.css might color it; JavaScript in app.js might attach a click handler. None of those files replaces the others—they stack.
02How browsers parse HTML into the DOM
<, identifies tag names and attributes, and constructs nodes: elements, text nodes, comments. When it sees <p>Hello</p>, it creates a p element with a text child. If you forget a closing tag—common with <li> or <p>—the parser applies error recovery rules defined in the HTML spec and inserts implied tags so the tree stays well-formed enough to render.The DOM is not the same as "View Source." View Source shows the bytes the server sent. The DOM may differ after the parser fixes errors and after JavaScript mutates the tree. Scripts without defer or async can block parsing because the parser must run them before continuing; modern pages usually place scripts at the end of <body> or use defer so HTML finishes first.
<div>
<p>First paragraph
<p>Second paragraph</p>
</div>A strict parser might reject this; HTML5 parsers close the first <p> when the second opens, yielding two sibling paragraphs inside the div. Knowing this prevents surprises when nesting interactive elements or custom components.
</ul> in a list, reload the page, and compare View Source to the Elements panel in DevTools.03Elements, tags, attributes, and void elements
<a>...</a> delimiters in source code. Attributes appear in the start tag: href="/about", class="nav-link", data-id="42". Boolean attributes like disabled or checked are present or absent; in HTML5 you write disabled rather than disabled="disabled".Void elements (also called empty elements) cannot have children: img, br, input, meta, link, hr, and others. In HTML5 you write them as <img src="photo.jpg" alt="Sunset"> without a closing tag. XHTML-style <img /> still works but is unnecessary.
Attributes have namespaces in practice: global attributes (id, class, hidden, title), element-specific ones (href on a, src on img), and data-* for custom metadata accessible from JavaScript via dataset.
<img src="logo.png" alt="Company logo" width="120" height="40" />
<input type="email" name="user_email" required autocomplete="email" />
<a href="https://example.com" rel="noopener">External site</a>div with classes—the element name carries meaning the class name cannot.data-* attribute; log the data attribute from the console.Document Skeleton & Head
3 items04The HTML5 document boilerplate
<!DOCTYPE html>, lang, charset, and viewport meta for predictable rendering.<!DOCTYPE html> triggers standards mode in browsers so layout matches modern CSS expectations instead of quirky legacy behavior. The root <html lang="en"> attribute helps screen readers pick pronunciation rules and search engines understand content language. <meta charset="utf-8"> must appear early in <head> so the parser knows how to decode multi-byte characters—place it within the first 1024 bytes.The viewport meta tag tells mobile browsers to use the device width as the layout width instead of pretending to be a desktop monitor:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>My Page</title>
</head>
<body>
<main>
<h1>Hello, world</h1>
</main>
</body>
</html>Without viewport meta, phones shrink a 980px-wide desktop layout, making text tiny. With it, your CSS media queries can respond to real device widths.
html5-boilerplate so you never hand-type DOCTYPE and charset from memory under pressure.05Head metadata: title, links, and icons
<head> holds machine-readable metadata and resource hints; nothing in <head> renders directly on the page.<title> appears in the browser tab and often in search results—it should be unique and descriptive per page. <link rel="stylesheet" href="main.css"> pulls in CSS. <link rel="icon" href="/favicon.ico" sizes="any"> sets the tab icon; you can also supply PNG/SVG icons for high-DPI screens.Preconnect and preload are performance hints:
<head>
<title>Product Details — ShopName</title>
<link rel="stylesheet" href="/css/main.css" />
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preload" href="/fonts/brand.woff2" as="font" type="font/woff2" crossorigin />
</head>preconnect opens early network connections; preload fetches critical assets sooner. Use them sparingly—each hint consumes bandwidth if the resource is not actually needed.
Scripts can live in <head> with defer (download in parallel, run after HTML parse) or async (download and run ASAP, order not guaranteed). Blocking scripts without those attributes pause HTML parsing.
<title> under ~60 characters when possible so it is not truncated in search snippets.06Body structure and skip links
<body> with a logical landmark order: header, main, footer—plus optional nav and aside.<body> contains everything users see and interact with. A typical document flow places global navigation in <header> or a dedicated <nav>, unique page content in <main>, supplementary widgets in <aside>, and site-wide footers in <footer>. There should be only one <main> per page unless you use hidden on inactive app views—screen readers jump to main as the primary content region.Skip links help keyboard users bypass repetitive navigation:
<body>
<a class="skip-link" href="#main">Skip to main content</a>
<header>
<nav aria-label="Primary">...</nav>
</header>
<main id="main">
<h1>Page heading</h1>
<!-- unique content -->
</main>
<footer>
<p>© 2026 Example Co.</p>
</footer>
</body>Visually hide the skip link off-screen until focused—a few lines of CSS make it appear at the top on :focus. This pattern is cheap to implement and dramatically improves keyboard UX on nav-heavy sites.
<main> as early as practical in DOM order after header/nav so tab order matches reading order.Semantics & Landmarks
4 items07Why semantic HTML matters
<div class="header"> and a <header> might look identical with CSS, but only <header> tells user agents "this is introductory content for its section." Semantics improve accessibility defaults: <button> is focusable and activated with Space/Enter; <a href> navigates; <input type="checkbox"> toggles state with built-in roles.Semantic markup also future-proofs your CSS. You can target article h2 instead of .card-title, reducing coupling to component class names. When JavaScript queries document.querySelector('main'), it survives redesigns that rename BEM classes.
<article>
<header>
<h2>Release notes v2.4</h2>
<time datetime="2026-03-01">March 1, 2026</time>
</header>
<p>We shipped dark mode and faster search.</p>
</article>Prefer the most specific element: nav for navigation groups, section for thematic grouping with a heading, article for self-contained syndicatable content.
div, pause and check whether section, article, figure, or details fits.article, header, and time; run Lighthouse accessibility and note any score change.08Headings and document outlines
<h1> per page (usually) and descend levels without skipping—headings form a navigable outline.h1–h6) are the primary way screen reader users skim a page. The <h1> typically matches the page's main topic; nested sections use h2, subsections h3, and so on. Skipping from h2 to h5 breaks outline algorithms and confuses assistive tech even if visuals look fine.In HTML5, sectioning elements (section, article, nav, aside) create implicit outline nodes when they contain headings. You do not need to wrap every heading in a section, but when you use <section>, give it a heading so the section has a name.
<main>
<h1>Baking basics</h1>
<section>
<h2>Equipment</h2>
<h3>Measuring cups</h3>
<h3>Mixers</h3>
</section>
<section>
<h2>Techniques</h2>
<p>...</p>
</section>
</main>Decorative icons next to headings should use aria-hidden="true" so they are not announced as meaningless text.
h4 because you want smaller text; pick the correct level and adjust font-size.09Landmarks: header, nav, main, aside, footer
<header>, <nav>, <main>, <aside>, <footer>, and <form> (when named). Multiple <header> and <footer> elements are valid—each belongs to its nearest sectioning ancestor. Multiple <nav> elements are fine if labeled: <nav aria-label="Footer"> vs <nav aria-label="Primary">.Landmarks reduce "navigation fatigue" for screen reader users who otherwise listen to every link on every page load. Combine landmarks with headings inside each region so users hear both region name and content summary.
<body>
<header role="banner"><!-- implicit with header at body level -->
<nav aria-label="Primary">...</nav>
</header>
<div class="layout">
<main id="content">
<h1>Dashboard</h1>
</main>
<aside aria-labelledby="tips-heading">
<h2 id="tips-heading">Tips</h2>
</aside>
</div>
<footer role="contentinfo">...</footer>
</body>Explicit role attributes are usually redundant when using correct elements—add them only when retrofitting legacy markup.
<nav> blocks without labels, then add aria-label to each; observe the difference in a screen reader's landmarks menu.10Figures, captions, and supplementary content
<figure> and <figcaption> for content referenced from the main flow; use <aside> for tangential content.<figcaption> provides a title or explanation. Order of figcaption before or after other figure content is flexible; CSS controls presentation.<figure>
<img src="chart.png" alt="Bar chart: Q1 revenue up 18% year over year" />
<figcaption>Figure 1. Quarterly revenue comparison</figcaption>
</figure>
<figure>
<pre><code>const sum = (a, b) => a + b;</code></pre>
<figcaption>Listing 1. A simple sum function</figcaption>
</figure><blockquote> marks extended quotations; cite the source in <footer> or with cite attribute on <q> for inline quotes. <details> and <summary> create native disclosure widgets without JavaScript—great for FAQs:
<details>
<summary>Shipping policy</summary>
<p>Orders ship within 2 business days.</p>
</details><figure> with an informative image still needs meaningful alt on the img—figcaption does not replace alt text.<details> elements; ensure keyboard users can expand each with Enter/Space.Text, Links, Lists & Tables
4 items11Text-level semantics and emphasis
<strong>, <em>, <code>, and friends for meaning; use CSS for purely visual styling.<strong> indicates strong importance or urgency; <em> stress emphasis that changes sentence meaning when read aloud. <mark> highlights text for reference purposes (search hits). <abbr title="HyperText Markup Language">HTML</abbr> expands abbreviations on hover/focus. <time datetime="2026-09-08">September 8, 2026</time> encodes machine-readable dates.For code, use <code> inline, <pre> for preformatted blocks, and <kbd> for user input keys:
<p>
Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save. The API returns
<code>{ "ok": true }</code> on success.
</p>
<p><strong>Warning:</strong> Do not expose API keys in client-side HTML.</p>Avoid <b> and <i> when meaning matters—they are stylistic hooks without semantic weight in HTML5. Line breaks: <br> only for poetry, addresses, or line breaks that are part of content—not for spacing paragraphs (use CSS margin).
<strong> with different inflection—do not wrap entire paragraphs unless truly urgent.em, strong, abbr, and code; listen with a screen reader and note how emphasis is conveyed.12Links, URLs, and safe external navigation
href; use descriptive text, meaningful rel values, and avoid "click here."<a> element with an href creates a hyperlink. Link text should describe the destination out of context—"Read the installation guide" beats "Click here." For external links opening new tabs, many teams add target="_blank" with rel="noopener noreferrer" to prevent the new page from accessing window.opener and to omit referrer data when desired.<a href="/docs/install">Installation guide</a>
<a href="https://partner.example" rel="noopener noreferrer" target="_blank">
Partner portal (opens in new tab)
</a>
<a href="#section-pricing">Jump to pricing</a>
<a href="mailto:support@example.com">Email support</a>
<a href="tel:+15551234567">Call us</a>Fragment identifiers (#id) scroll to elements with matching id. Email and telephone URLs trigger native handlers on capable devices. Download attributes suggest filenames for same-origin resources: <a href="/report.pdf" download>Download PDF</a>.
<button type="button"> styled as a link—do not use href="#".h2 sections; verify focus moves and URL hash updates.13Lists: ordered, unordered, and description lists
ul for unordered, ol for sequence, dl for terms and definitions.ul > li) suit collections without order—features, tags, nav items when order is not meaningful. Ordered lists (ol > li) imply sequence—steps in a recipe, ranked items. The start, reversed, and type attributes adjust numbering when needed, though CSS counters often replace type.Description lists (dl) pair terms (dt) with definitions (dd). One term can have multiple definitions; multiple terms can share a definition group:
<ol>
<li>Preheat oven to 180 °C.</li>
<li>Mix dry ingredients.</li>
<li>Bake for 25 minutes.</li>
</ol>
<dl>
<dt>HTML</dt>
<dd>Structure layer of the web.</dd>
<dt>CSS</dt>
<dd>Presentation layer.</dd>
</dl>Do not use lists purely for indentation—that is a CSS job. Nested lists belong inside the parent li, not as siblings between items.
ul > li > a inside nav—a pattern browsers and assistive tech understand well.dl; nest a ul inside one dd for sub-points.14Tables for tabular data
<th>, scope, and <caption> for clarity.<table> > optional <caption>, <thead>, <tbody>, <tfoot>, rows <tr>, header cells <th>, data cells <td>. The scope attribute on <th> clarifies whether the header applies to a column (col), row (row), or group.<table>
<caption>Monthly subscription plans</caption>
<thead>
<tr>
<th scope="col">Plan</th>
<th scope="col">Price</th>
<th scope="col">Storage</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Starter</th>
<td>$9</td>
<td>10 GB</td>
</tr>
<tr>
<th scope="row">Pro</th>
<td>$29</td>
<td>100 GB</td>
</tr>
</tbody>
</table>For complex tables spanning multiple rows/columns, headers and id associate data cells with multiple headers. Responsive tables often scroll horizontally in a wrapper div with overflow-x: auto rather than breaking semantic structure.
<table> for multi-column page layouts—CSS Grid and Flexbox replaced that anti-pattern decades ago.Forms & Validation
4 items15Form structure and basic controls
<form>, label every control, and choose the right input type.<form> element defines a submission unit with action (URL) and method (get or post). Each control needs an associated <label>—wrap the input or use for matching input id. Labels increase hit area and are required for accessibility.Common controls:
<form action="/subscribe" method="post">
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required />
<label for="plan">Plan</label>
<select id="plan" name="plan">
<option value="free">Free</option>
<option value="pro" selected>Pro</option>
</select>
<label><input type="checkbox" name="newsletter" value="yes" /> Send updates</label>
<button type="submit">Subscribe</button>
</form>button type="submit" submits the form; type="button" does not; type="reset" clears fields (rarely useful). Group related options with <fieldset> and <legend>.
name attributes determine keys in submitted form data—omit them and the field will not appear in the payload.16Input types and mobile keyboards
email, url, tel, number, range, date, time, color, search, and password. Browsers render suitable pickers and validate formats before submit—type="email" rejects strings without @. On phones, type="tel" shows a numeric keypad; type="url" may prefer a URL keyboard layout.<label for="age">Age</label>
<input id="age" name="age" type="number" min="13" max="120" step="1" />
<label for="site">Website</label>
<input id="site" name="site" type="url" placeholder="https://example.com" />
<label for="birthday">Birthday</label>
<input id="birthday" name="birthday" type="date" />placeholder shows hint text but is not a label substitute—it disappears on input and may fail contrast requirements. Use visible labels plus optional hint text linked via aria-describedby.
text, so your server must still validate.email, tel, and number on a phone or emulator; compare keyboards for each field.17Client-side validation attributes
required, minlength, maxlength, pattern, min, max, and step participate in constraint validation. Invalid fields match :invalid in CSS and block form submission until fixed—unless the form has novalidate. Custom messages use JavaScript setCustomValidity() because there is no native message attribute.<label for="username">Username (3–16 letters)</label>
<input
id="username"
name="username"
required
minlength="3"
maxlength="16"
pattern="[A-Za-z0-9_]+"
title="Letters, numbers, and underscore only"
/>
<label for="zip">US ZIP</label>
<input id="zip" name="zip" pattern="\d{5}(-\d{4})?" required />The pattern attribute takes a JavaScript regular expression without delimiters. For internationalized apps, regex in HTML may be too rigid—combine light client hints with robust server rules.
:focus-visible and :user-invalid (where supported) to show errors without relying solely on browser tooltips.novalidate and compare behavior.18Accessible forms and grouping
<fieldset> and <legend> for radio/checkbox groups:<fieldset>
<legend>Preferred contact method</legend>
<label><input type="radio" name="contact" value="email" checked /> Email</label>
<label><input type="radio" name="contact" value="phone" /> Phone</label>
</fieldset>When validation fails, associate error text with the field:
<label for="pwd">Password</label>
<input id="pwd" type="password" aria-describedby="pwd-rules pwd-error" required />
<p id="pwd-rules">At least 12 characters.</p>
<p id="pwd-error" role="alert" hidden>Password is too short.</p>Toggle hidden or aria-invalid="true" from JavaScript when showing errors. Required fields can be indicated visually (*) and with aria-required="true" if not using the required attribute.
aria-describedby; trigger an error and listen with a screen reader.Media & Responsive Images
3 items19Images: src, alt, and dimensions
img needs alt; provide width and height to prevent layout shift.src attribute points to the image resource. The alt attribute provides alternative text when the image cannot be displayed and is announced by screen readers for informative images. Decorative images use empty alt: alt="" so assistive tech skips them.<img
src="hero.jpg"
alt="Team collaborating around a laptop in a bright office"
width="1200"
height="630"
loading="lazy"
/>Explicit width and height let the browser reserve space before the image downloads, improving Cumulative Layout Shift metrics. loading="lazy" defers off-screen images until the user scrolls near them—do not lazy-load above-the-fold heroes.
20Responsive images with srcset and sizes
srcset and sizes so mobile users do not download desktop megapixel assets.srcset lists candidate URLs with width (800w) or density (2x) descriptors. The browser picks one based on viewport and DPR. Pair srcset with sizes to tell the browser how wide the image will render at different breakpoints:<img
src="product-800.jpg"
srcset="product-400.jpg 400w, product-800.jpg 800w, product-1200.jpg 1200w"
sizes="(max-width: 600px) 100vw, 400px"
alt="Wireless headphones, matte black"
width="400"
height="400"
/>Here, viewports under 600px use full viewport width; larger viewports assume 400px display width—browser selects the closest resource. <picture> adds art direction—different crops per breakpoint:
<picture>
<source media="(min-width: 800px)" srcset="banner-wide.jpg" />
<source media="(min-width: 480px)" srcset="banner-medium.jpg" />
<img src="banner-narrow.jpg" alt="Spring sale banner" />
</picture>src as a fallback for older browsers and as the default selected URL.img with three srcset widths; throttle network in DevTools and resize the viewport to see which file downloads.21Audio, video, and track elements
<video> and <audio> support multiple sources, posters, and captions via <track>.<source> children so browsers pick the first supported format:<video controls width="640" height="360" poster="preview.jpg">
<source src="clip.webm" type="video/webm" />
<source src="clip.mp4" type="video/mp4" />
<track kind="captions" src="clip.en.vtt" srclang="en" label="English" default />
<p>Your browser does not support HTML video. <a href="clip.mp4">Download the clip</a>.</p>
</video>The controls attribute shows native UI. poster displays before playback. <track kind="captions"> links WebVTT files for subtitles—essential for accessibility and noisy environments. Autoplay with sound is blocked by most browsers; muted autoplay is sometimes allowed but should be used sparingly.
For audio podcasts or sound effects, <audio controls src="episode.mp3"></audio> suffices. Always provide fallback content inside the element for unsupported browsers.
Accessibility & ARIA
3 items22Accessibility fundamentals in HTML
:focus-visible styles.Provide text alternatives: alt for images, transcripts or captions for video, visible labels for inputs. Color contrast between text and background should meet WCAG AA (4.5:1 for normal text). Do not convey state by color alone—pair "Error" text or icons with aria-invalid.
<button type="button" aria-pressed="false" id="toggle">Dark mode</button>Test with keyboard only, zoom to 200%, and run automated checks (axe, Lighthouse)—but manual testing catches nuance automation misses.
23ARIA roles, states, and properties
role="dialog", role="tablist"). Properties describe relationships (aria-labelledby, aria-controls, aria-describedby). States reflect dynamic values (aria-expanded, aria-selected, aria-hidden).<div role="tablist" aria-label="Account settings">
<button role="tab" id="tab-profile" aria-selected="true" aria-controls="panel-profile">
Profile
</button>
<button role="tab" id="tab-billing" aria-selected="false" aria-controls="panel-billing">
Billing
</button>
</div>
<div role="tabpanel" id="panel-profile" aria-labelledby="tab-profile">...</div>
<div role="tabpanel" id="panel-billing" aria-labelledby="tab-billing" hidden>...</div>Custom widgets must implement expected keyboard patterns (Arrow keys for tabs, Escape to close dialogs). Libraries like native <dialog> reduce ARIA burden:
<dialog id="confirm">
<p>Delete this item?</p>
<form method="dialog">
<button value="cancel">Cancel</button>
<button value="confirm">Delete</button>
</form>
</dialog>role does not add behavior—you must implement focus management and keyboard support in JavaScript.<dialog> with showModal() and confirm focus traps inside until closed.24Live regions and announcements
aria-live regions so dynamic updates are announced without moving focus.aria-live="polite" queues announcements when the user is idle; aria-live="assertive" interrupts immediately for critical alerts.<div aria-live="polite" aria-atomic="true" id="status"></div>
<!-- JS: status.textContent = '3 items added to cart'; -->
<div role="alert">Payment failed. Check your card number.</div>
<!-- role="alert" implies aria-live="assertive" -->Use aria-atomic="true" when the entire region should be read, not just changed nodes. Hide decorative live-region spam—update only when meaningful. Prefer visible text inside live regions; do not rely on aria-label alone for complex messages.
SEO & Meta
2 items25Meta tags for discovery and sharing
<meta name="description" content="..."> often appears under the blue link in search results—write unique descriptions (~150 characters) per page. Canonical URLs prevent duplicate content issues:<link rel="canonical" href="https://example.com/docs/html" />
<meta name="description" content="Learn HTML from document structure to forms and accessibility." />Open Graph and Twitter Card tags control link previews on social platforms:
<meta property="og:title" content="HTML Learning Notes" />
<meta property="og:description" content="30 in-depth lessons for modern HTML." />
<meta property="og:image" content="https://example.com/og-cover.jpg" />
<meta property="og:url" content="https://example.com/learn/html" />
<meta name="twitter:card" content="summary_large_image" />Robots meta instructs crawlers: <meta name="robots" content="noindex, nofollow"> for staging pages. Structured data (JSON-LD) often lives in a <script type="application/ld+json"> block—complementary to HTML, not a replacement for semantic markup.
og:url and canonical to the preferred URL users should share.26Semantic structure for crawlers and humans
<h1>, descriptive <title>, internal links with anchor text that names destinations, and alt text that describes images honestly.Performance is an SEO factor: large unoptimized images, render-blocking scripts, and missing dimensions hurt rankings and users. Semantic <article> with <time datetime> helps parsers recognize publish dates for news content.
<article itemscope itemtype="https://schema.org/Article">
<header>
<h1 itemprop="headline">Understanding semantic HTML</h1>
<p>By <span itemprop="author">Alex Rivera</span></p>
<time itemprop="datePublished" datetime="2026-09-08">Sep 8, 2026</time>
</header>
<div itemprop="articleBody">...</div>
</article>Microdata (shown above) is optional; JSON-LD is often easier to maintain. Focus first on visible structure—rich results follow good HTML.
<title>, single h1, and internal links; list three concrete SEO improvements without adding spammy keywords.Storage & Browser APIs
2 items27Embedding data with data attributes and template
data-* attributes and <template> to hold configuration and inert markup for JavaScript cloning.data-* attributes store small pieces of config accessible from CSS (attr(data-state) in modern browsers) and JS (element.dataset.state):<button class="tabs" data-tab="overview" aria-selected="true">Overview</button>
<ul data-page-size="20" id="results"></ul>document.querySelector('#results').dataset.pageSize; // "20"<template> contents are inert—scripts do not run, images do not load—until cloned into the DOM:
<template id="card-template">
<article class="card">
<h2></h2>
<p class="summary"></p>
</article>
</template>const node = document.getElementById('card-template').content.cloneNode(true);
node.querySelector('h2').textContent = 'Hello';
document.body.appendChild(node);This pattern keeps HTML as the single source for component structure instead of concatenating strings in JavaScript.
type="application/json" and an id reference.<template> for a list item, clone it three times with different text purely from JavaScript.28Local storage hooks and progressive enhancement
localStorage, sessionStorage, IndexedDB) has no HTML equivalent but integrates via attributes and conventions: autocomplete helps browsers and password managers; name values become keys in serialized storage patterns.The `contenteditable` attribute makes elements editable in supporting browsers:
<div contenteditable="true" role="textbox" aria-label="Quick notes">
Type notes here...
</div>Use cautiously—editable regions need sanitization when syncing to servers. The `hidden` attribute removes elements from layout and accessibility tree until removed. `inert` (where supported) blocks interaction for off-screen modals:
<div id="app" inert>...</div>
<dialog open>...</dialog>Feature detect in JavaScript and keep critical paths working when APIs are absent.
<dialog> over div-based modals—it handles focus trapping and inert backdrop behavior in modern browsers.contenteditable; save its innerHTML to localStorage on blur and restore on load.Mini Projects & Walkthroughs
2 items29Project: Personal profile page
<title>, one stylesheet link. Structure with <header> (name and tagline), <nav aria-label="Primary"> linking to in-page sections, <main> with <section> blocks for About, Projects, and Contact.In About, use a responsive <img> with meaningful alt, width, height, and srcset. Projects should be an <ul> of <article> cards—each with h3, short paragraph, and external link with rel="noopener noreferrer". Contact uses a <form> or mailto: / tel: links labeled clearly.
<main>
<section id="about" aria-labelledby="about-heading">
<h2 id="about-heading">About</h2>
<img src="portrait-400.jpg" srcset="portrait-400.jpg 400w, portrait-800.jpg 800w"
sizes="(max-width: 600px) 80vw, 200px"
alt="Portrait of Jordan Lee, software developer" width="200" height="200" />
<p>I build accessible web interfaces...</p>
</section>
<section id="projects" aria-labelledby="projects-heading">
<h2 id="projects-heading">Projects</h2>
<ul>
<li>
<article>
<h3>Notes app</h3>
<p>Offline-first markdown notes.</p>
<a href="https://github.com/example/notes">View repository</a>
</article>
</li>
</ul>
</section>
</main>Add a skip link, footer with copyright, and validate with Lighthouse. This project exercises lessons 4–14 and 19–22 in one deliverable.
30Project: Accessible multi-step signup form
<form> wrapping all steps or separate fieldsets per step with JavaScript toggling visibility—either way, maintain labels, fieldset/legend, and logical tab order.Step 1: email (type="email", required, autocomplete="email"), password (minlength="12", described by rules text). Step 2: name, optional website (type="url"), plan <select>. Step 3: summary list (dl) of entered values and a submit button.
Wire validation messages to aria-describedby and a role="alert" container. On step change, move focus to the step heading (tabindex="-1" temporarily) and update a polite live region: "Step 2 of 3: Profile details." Use native constraint validation before custom JS.
<form action="/register" method="post" novalidate>
<p aria-live="polite" id="step-status">Step 1 of 3: Account</p>
<fieldset data-step="1">
<legend>Account</legend>
<!-- fields -->
<button type="button" data-next>Continue</button>
</fieldset>
<fieldset data-step="2" hidden>
<legend>Profile</legend>
<!-- fields -->
<button type="button" data-back>Back</button>
<button type="button" data-next>Continue</button>
</fieldset>
<fieldset data-step="3" hidden>
<legend>Review</legend>
<dl id="review"></dl>
<button type="submit">Create account</button>
</fieldset>
</form>Without JavaScript, all fieldsets could display stacked as a long form—still submittable. With JS, enhance to a wizard. This mirrors real product work: HTML baseline, JS enhancement, accessibility throughout.
FormData in DevTools during development to verify field names before connecting a backend.