HTML & CSS Course
HTML & CSS
/
Beginner

HTML Interview Questions

Definition

Common questions asked during front-end interviews to test foundational HTML knowledge.

Explain Like I'm New

Interviewers use these to check if you skipped the basics and went straight to React. They want to know if you understand accessibility, SEO, and document structure.

Real World Example

Being asked the difference between a `<div>` and a `<span>`, or why the `alt` attribute exists.

Common Use Cases

  • •Junior/Mid Front-End Developer Interviews

Terminal Output

bash / terminal
/* Q: Explain Semantic HTML and give an example of why it matters. A: Semantic HTML means using tags that describe the MEANING of the content, not just how it looks. Example: Using a <button> instead of a <div class="btn">. Why it matters: 1. Accessibility: Screen readers know a <button> can be clicked, but they think a <div> is just plain text. 2. Usability: A <button> natively supports keyboard navigation (Tab key) and the 'Enter' key to trigger clicks. A <div> does not. 3. SEO: Search engines understand the structure of the page better when you use <article>, <nav>, and <footer>. */

Interview Questions

basic

  • What is the difference between a `<div>` and a `<span>`?

intermediate

  • What is the difference between `<script defer>` and `<script async>`?

Flash Cards

Question

div vs span?

Click to reveal answer
Answer

A `<div>` is a block-level element (takes up full width, creates a line break). A `<span>` is an inline element (takes up only necessary width, sits inside sentences).

Question

defer vs async?

Click to reveal answer
Answer

`async` downloads the script and runs it immediately, pausing HTML parsing. `defer` downloads the script in the background but guarantees it won't execute until the HTML is fully parsed.