83 questions in 7 topics
HTML Basics Interview Questions
Document structure, elements and attributes, lists, tables, links and entities, as asked in campus placements and first rounds.
- What is HTML?
- What is the difference between a tag, an element and an attribute in HTML?
- What is
<!DOCTYPE html>and why is it needed? - What is the basic structure of an HTML document?
Semantic HTML Interview Questions
Choosing elements by meaning: article vs section, strong vs b, headings, main and the HTML5 elements.
- What is semantic HTML, and why does it matter?
- What is the difference between
<article>and<section>? - When should you use
<section>instead of<div>? - What is the difference between
<b>and<strong>, and between<i>and<em>?
HTML Forms and Inputs Interview Questions
How forms send data, input types, labels, validation and the attributes behind common form bugs.
- How does an HTML form send data, and why does every input need a
name? - What is the difference between GET and POST in a form?
- Why should you use
<label>with form inputs? - What input types does HTML5 provide?
HTML5 APIs and Media Interview Questions
Audio, video, canvas and SVG, data attributes, dialog, template and the browser APIs that came with HTML5.
- How do you add audio and video to a page?
- Why does
autoplaynot work on my video? - What is the difference between
<canvas>and SVG? - What is the difference between
localStorage,sessionStorageand cookies?
HTML Accessibility Interview Questions
Labels, ARIA, keyboard support, focus and live regions, now standard in front end interviews.
- What is web accessibility, and how does HTML help?
- Why should you set the
langattribute on<html>? - What is ARIA, and when should you use it?
- Why is
<div onclick>not a good replacement for<button>?
HTML SEO and Meta Tags Interview Questions
Title, description, viewport, charset, canonical, Open Graph, robots, hreflang and structured data.
- Which HTML tags matter most for SEO?
- What does the viewport meta tag do?
- Do the meta description and meta keywords tags affect ranking?
- Why do you need
<meta charset="utf-8">, and where does it go?
Advanced HTML Interview Questions
Script loading, the rendering path, parser error recovery, resource hints, responsive images, web components and security.
- What is the difference between
asyncanddeferon a script tag? - How does the browser turn HTML into pixels (the critical rendering path)?
- What is the difference between
DOMContentLoadedandload? - What does the browser do with invalid HTML like a
<div>inside a<p>?
Frequently Asked Questions
How do I prepare for an HTML interview?
Build small pages by hand: a validated form, an accessible menu, a data table, a page with correct meta tags. Be able to explain each topic here in two sentences and write the markup from memory. Revise CSS layout and DOM basics too, since HTML is rarely asked alone.
What HTML topics are asked to freshers?
Document structure and the doctype, common tags, block vs inline, id vs class, lists and tables, links and images with alt, forms and input types, semantic elements, and what HTML5 added. Expect to write a small form or layout, often with a few CSS questions.
What is asked in an HTML interview for experienced developers?
More about how the browser works than about tags: async and defer, the rendering path, resource hints, image performance, ARIA, SEO and XSS. You may be asked to review markup and point out problems.
Is HTML enough to get a front end developer job?
No. Front end roles expect CSS and JavaScript, usually a framework such as React, and Git. Strong HTML still sets you apart, because many developers who learned a framework first get accessible, semantic markup wrong.
Do front end interviews include DSA questions?
Many do, especially at product companies and in campus placements: easy to medium array, string and hash map problems in JavaScript. The problems at the end of this page are a good start.