HTML Interview Questions & Answers
Prepare for HTML technical interviews with 100 curated questions and answers — from fundamentals to Tech Lead. Semantics, accessibility, forms, and browser fundamentals. Each question includes a short interview answer, detailed explanation, examples, tips, and common mistakes.
HTML interview topics
Jump into a category — each bank is independent and interview-focused.
All HTML interview questions
Semantics interview questions
View categoryWhat does semantic HTML mean, and why do interviewers care?
freshWhen should you use <section> vs <article> vs <div>?
freshWhat is the difference between <header>, <head>, and heading elements?
juniorWhy is a single <main> landmark important?
juniorHow do you structure a blog post with semantic HTML?
juniorWhat is the HTML outline and how do browsers treat heading levels?
midWhen is <aside> appropriate?
midExplain <nav> usage — one or many?
midWhat are phrasing vs flow content, and why does it matter?
midHow would you mark up a FAQ for accessibility and SEO?
seniorWhat is the role of <figure> and <figcaption>?
seniorWhen should you use <address>?
seniorDesign a semantic layout for a dashboard with app chrome and widgets.
leadAccessibility interview questions
View categoryWhat makes an accessible name for a control?
freshWhy are clickable <div>s an accessibility problem?
freshExplain alt text strategy for images.
juniorHow does focus management work for modals?
juniorWhat is the difference between aria-hidden and the hidden attribute?
juniorHow do you make a custom checkbox accessible?
midWhat are skip links and why do they matter?
midHow do you handle accessible error messages in forms?
midContrast and focus visibility — what do you check?
seniorWhat is a live region and when is it dangerous?
seniorHow would you accessibility-test a SPA route change?
seniorDescribe keyboard interaction for a tabs widget.
seniorHow do you build an a11y culture on a frontend team?
leadForms interview questions
View categoryWhy should every input have a <label>?
freshWhat does the required attribute do vs JavaScript validation?
freshExplain name vs id on form controls.
juniorHow do fieldset and legend improve forms?
juniorWhat is autocomplete and why does it matter?
juniorHow does constraint validation API work?
midWhen do you choose GET vs POST for forms?
midHow do you build an accessible multi-step form?
midWhat are the risks of disabling native form submit?
seniorExplain input types email, tel, url, number — benefits and pitfalls.
seniorHow should file inputs be labeled and constrained?
seniorWhat is enctype multipart/form-data and when is it required?
leadDesign a form system API for a design system team.
leadMedia interview questions
View categoryWhen do you use <img> vs CSS background-image?
freshExplain srcset and sizes.
freshWhat does the <picture> element solve?
juniorHow do you make video accessible?
juniorWhat are preload, autoplay, and muted on media elements?
juniorHow does lazy loading images work in HTML?
midExplain object-fit vs changing intrinsic image size.
midHow would you deliver responsive hero images efficiently?
midWhat is the track element used for?
seniorWhen is <audio> preferable to embedding third-party players?
seniorHow do you prevent layout shift with media?
seniorArchitect a media pipeline for a content site.
leadSEO interview questions
View categoryWhat is the role of the <title> element for SEO?
freshExplain meta description best practices.
freshHow do canonical URLs help?
juniorWhat Open Graph tags matter for sharing?
juniorHow does heading structure affect SEO?
juniorWhat is robots meta vs robots.txt?
midWhen should you use JSON-LD structured data?
midHow do SPAs hurt SEO if misconfigured?
midWhat is hreflang used for?
seniorHow do you SEO-audit a marketing landing page?
seniorWhy do crawlable links matter more than onclick navigation?
seniorDefine an SEO content architecture for a large docs site.
leadAPIs interview questions
View categoryWhat is the Dialog API / <dialog> element?
freshExplain the Details/Summary disclosure widget.
freshWhat does the Popover API enable?
juniorHow does the Clipboard API differ from execCommand?
juniorWhat is contenteditable used for, and what are risks?
juniorExplain Intersection Observer at a high level for HTML apps.
midWhat is the History API used for in HTML apps?
midHow does the Drag and Drop API work?
midWhat are custom elements in relation to HTML?
seniorWhen would you use template and slot?
seniorHow do you feature-detect HTML APIs safely?
seniorFull-screen API considerations?
leadHow do you choose native HTML APIs vs JS libraries for UI widgets?
leadPerformance interview questions
View categoryWhich HTML choices most affect LCP?
freshWhat does <link rel=preload> do?
freshExplain defer vs async on script tags.
juniorHow do resource hints dns-prefetch, preconnect, prefetch differ?
juniorWhy do width/height on images matter for performance UX?
juniorHow does critical CSS relate to HTML?
midWhat is the cost of too many third-party scripts in head?
midWhen should you use loading=lazy on iframes?
midHow do you prioritize fonts in HTML?
seniorWhat HTML streaming/SSR concerns affect performance?
seniorHow can <link rel=modulepreload> help?
seniorDefine a performance budget for HTML assets on a content site.
leadSecurity interview questions
View categoryHow does HTML contribute to XSS defense?
freshWhy is target=_blank a security concern?
juniorWhat does the sandbox attribute on iframes do?
juniorExplain Content-Security-Policy at a high level for HTML apps.
juniorWhy is inline event handlers (onclick=) risky?
juniorHow do you safely embed user-generated HTML?
midWhat are dangerous URL schemes in href/src?
midHow does autocomplete=off relate to security?
midWhat is referrer policy useful for?
seniorHow can meta refresh be abused?
seniorForm security basics beyond HTTPS?
seniorHow do you threat-model a rich text comment feature?
lead