HTML interview questions test whether you can mark up a page correctly, not whether you memorized every tag. Expect semantics vs div, form accessibility, meta/viewport, heading order, and how browsers parse invalid HTML. Answer with a rule plus a one-line example.
This HTML cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.
Quick reference
- Semantic: Use tags that describe meaning (
nav,main,button) so AT and CSS have a stable contract. - Block vs inline: Block starts a new line and takes width; inline flows.
divvsspanis the classic pair. - Void:
img,input,br,hr,meta,linkcannot have children. - Alt: Alt is the text replacement for an image, not SEO keyword stuffing.
- Label:
for/idor wrapping. Placeholders are not labels. - Doctype: Triggers standards mode. HTML5 doctype is
<!DOCTYPE html>. - Storage: HTML does not store data. Cookies,
localStorage, and servers do — do not confuse markup with JS APIs. - SVG vs canvas: SVG is retained-mode markup; canvas is a pixel surface you redraw in script.
Copy-paste examples
Interview-ready form control
Be ready to write a labeled required email field from memory.
<label for="email">Work email</label>
<input id="email" name="email" type="email" required autocomplete="email">Common mistakes
- Saying HTML is a programming language — interviewers treat that as a red flag.
- Confusing
<b>/<i>(presentational) with<strong>/<em>(meaning). - Claiming
divis “bad” instead of “use it when there is no meaning.” - Skipping accessibility: no labels, no alt, clickable divs.
FAQ
- Block, inline, or inline-block? In interviews, mention the box: block fills the row, inline shrinks to content and ignores width/height, inline-block is the hybrid. Then say CSS
displaycan change this.
- What happens if I omit BLOGPH0 ? The HTML parser infers an end tag in many cases. Do not rely on that in production; write explicit structure.
- How is HTML different from XML? HTML is forgiving and has a specific parser. XML is strict. Browsers do not treat your
.htmlfile as XML unless you serve XHTML MIME.
Related HTML cheat sheets
Build with this stack
When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds custom web development and also sells ready-made source code. Request a quote and tell us the stack.
Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.