Skip to main content
Journey Uncommon Logo
JourneyUncommon
HTML · PRACTICE

HTML interview questions.

HTML is the document layer of the web. Getting it right is most of accessibility and a surprising amount of SEO.

574questions
124easy
225medium
225hard

Semantic element choice, form and label association, the accessibility tree, parser quirks around nesting, and how script loading attributes change execution order.

Where it shows up: Every frontend role, plus email, content and accessibility-focused engineering work.

Sample HTML questions

Twenty real HTML questions from the library, code snippet included. Nothing here is paraphrased for search engines. It is the same text a signed-in user sees.

hardaccessible-name algorithm

The accessible name computation algorithm (accname) has a strict precedence order for computing an element's name. For an <input type="text"> that has aria-labelledby, aria-label, an associated <label>, a title, and a placeholder all present, which source wins and why?

<label for="f">Native label</label>
<input id="f" type="text"
  aria-labelledby="a b" aria-label="aria label"
  title="the title" placeholder="type here">
<span id="a">First</span><span id="b">Second</span>
Read the full question →
hardobservedAttributes

A custom element's class declares `observedAttributes` as a `static` class field initialized from a helper that reads from a config object. The element is defined, then the config object is mutated and a NEW subclass is defined that inherits (does not redeclare) `observedAttributes`. How does the engine resolve `observedAttributes` for the subclass, and what does this reveal about where the list lives?

const cfg = { attrs: ['a'] };
class Base extends HTMLElement {
  static get observedAttributes(){ return cfg.attrs; }
  attributeChangedCallback(n){ console.log('base', n); }
}
customElements.define('x-base', Base);
cfg.attrs = ['a', 'b'];
class Sub extends Base {} // no own observedAttributes
customElements.define('x-sub', Sub);
Read the full question →
Sign in to answer

Everything above is free to read. Answering needs a free account.

We keep the correct answer, the explanation and the scoring behind sign-in so the platform stays honest, which is why the answer options and the worked explanation for every HTML question stay behind a free account. Signing in is free and takes a few seconds.

HTML topics covered

46 distinct HTML topics are tagged across the library. These are the real topic labels stored on the questions, not a hand-written list.

  • content models (41)
  • validation attrs required pattern (39)
  • advanced inputs date range color (29)
  • rel values usage (27)
  • accessible tables scope caption (22)
  • video audio tracks (20)
  • datalist output (20)
  • picture srcset (19)
  • slotted part exportparts (18)
  • iframe sandbox (17)
  • links a href (16)
  • ARIA basics (16)
  • async defer parsing internals (16)
  • dialog element (14)
  • paragraphs (13)
  • accessible-name algorithm (13)
  • fieldset legend (13)
  • meta viewport charset (12)
  • loading lazy decoding (12)
  • declarative shadow DOM (12)
  • entities and encoding (11)
  • microdata data attributes (11)
  • custom-element lifecycle (11)
  • parsing and tokenization states (10)
  • doctype (9)
  • form-associated custom elements ElementInternals (9)
  • template element (9)
  • the preload scanner (9)
  • head vs body (8)
  • setFormValue setValidity (8)
  • details summary (8)
  • shadow DOM open closed (8)
  • observedAttributes (8)
  • DOM tree construction (8)
  • parser error recovery quirks mode (8)
  • tabindex focus order (7)
  • headings (7)
  • speculation rules prerender (6)
  • host and host-context (6)
  • the accessibility tree (5)
  • br hr (4)
  • Popover API top layer (4)
  • accessibility tree (3)
  • preload scanner (3)
  • the accessible-name algorithm (2)
  • paragraphs br hr (2)

Search and filter every HTML question

Difficulty