HTML Interview Prep – What I Wish I Knew Before My First Interview! 😅

Table of contents
- My HTML Interview Struggles 😭
- 📝 Most Common HTML Interview Questions & Answers
- 1️⃣ What is HTML?
- 2️⃣ What is DOCTYPE in HTML?
- 3️⃣ What are semantic tags in HTML?
- 4️⃣ What is the difference between <div> and <span>?
- 5️⃣ What are meta tags in HTML?
- 6️⃣ What is the difference between <strong> and <b>, <em> and <i>?
- 7️⃣ What are self-closing tags?
- 8️⃣ What is the difference between absolute and relative links?
- 9️⃣ What is the difference between <ul> and <ol>?
- 🔟 What is the difference between id and class?
- Bonus Questions You Should Prepare:
- 🚀 My Advice for HTML Interview Prep

My HTML Interview Struggles 😭
When I started learning web development, I was excited about HTML & CSS. I built a ton of static websites, adding cool fonts and colors. But there was one thing I didn't focus on – interview preparation. And that came back to bite me!
I remember my first HTML interview vividly. The interviewer asked, “Which DOCTYPE are we using?” and “What is a semantic tag?” I completely blanked out. The funny part? I had used those tags in my projects but had no clue what they were actually called! 🤦♂️
That experience taught me a valuable lesson: knowing how to build websites is not enough – you need to be able to explain what you're doing in an interview.
So today, I’m sharing all the essential HTML questions that will help you ace your interviews. Trust me, preparing for these will save you from the panic I felt. 😅
📝 Most Common HTML Interview Questions & Answers
1️⃣ What is HTML?
Answer: HTML (HyperText Markup Language) is the backbone of the web. It structures content using elements like headings, paragraphs, links, images, and lists.
2️⃣ What is DOCTYPE in HTML?
Answer: DOCTYPE declares the HTML version being used in the document. The latest version is:
<!DOCTYPE html>
This tells the browser that we are using HTML5.
3️⃣ What are semantic tags in HTML?
Answer: Semantic tags give meaning to the structure of a webpage. Examples include:
<header>
– Represents the page’s header<nav>
– Defines navigation links<article>
– Represents self-contained content<footer>
– Defines footer content<section>
– Groups related content together
These help search engines and developers understand the content better.
4️⃣ What is the difference between <div>
and <span>
?
Answer:
<div>
is a block-level element used for grouping multiple elements.<span>
is an inline element used for styling small parts of text.
Example:
<div style="background-color: yellow;">This is a div</div>
<span style="color: red;">This is a span</span>
5️⃣ What are meta tags in HTML?
Answer: Meta tags provide metadata about a webpage. Example:
<meta charset="UTF-8">
<meta name="description" content="Learn HTML interview questions">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6️⃣ What is the difference between <strong>
and <b>
, <em>
and <i>
?
Answer:
<strong>
and<b>
both make text bold, but<strong>
has semantic meaning for importance.<em>
and<i>
both italicize text, but<em>
gives emphasis.
7️⃣ What are self-closing tags?
Answer: Self-closing tags don’t need a closing tag. Examples:
<img src="image.jpg" alt="An image">
<input type="text" placeholder="Enter text">
<hr>
8️⃣ What is the difference between absolute and relative links?
Answer:
Absolute link: Full URL including domain (e.g.,
https://example.com/about.html
)Relative link: Only the file path relative to the current page (e.g.,
about.html
)
9️⃣ What is the difference between <ul>
and <ol>
?
Answer:
<ul>
(unordered list) creates bullet points.<ol>
(ordered list) creates a numbered list.
Example:
<ul>
<li>Apples</li>
<li>Bananas</li>
</ul>
<ol>
<li>First Step</li>
<li>Second Step</li>
</ol>
🔟 What is the difference between id
and class
?
Answer:
id
is unique and used for a single element (id="header"
)class
can be used on multiple elements (class="btn"
)
Example:
<div id="header">Unique Header</div>
<button class="btn">Click me</button>
Bonus Questions You Should Prepare:
What are HTML attributes?
What is the difference between HTML and XHTML?
What is the purpose of the
<figure>
and<figcaption>
tags?What are data attributes (
data-*
)?How does the
<iframe>
tag work?What are the different types of input elements in HTML?
What is the difference between
<label>
and<legend>
?What is progressive enhancement in HTML?
How do you make an HTML element accessible?
What is the
<template>
tag used for?
🚀 My Advice for HTML Interview Prep
👉 Don’t just build websites, prepare for interviews too! After creating projects, spend time reviewing common interview questions.
👉 Make your own notes in your own words. This will help you remember better.
👉 Understand the concepts, don’t just memorize definitions. If the interviewer is an old-school type, they may want textbook answers, but modern interviews focus on understanding.
👉 Practice explaining concepts out loud. Teaching someone (or pretending to) helps reinforce learning.
Need 1-on-1 interview guidance or mock interviews? I’d love to help! 😊
🎯 Book a session with me: Topmate
Like, share, and comment if this helped! Follow me for more interview tips! 🚀
Subscribe to my newsletter
Read articles from Richa リチャ directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Richa リチャ
Richa リチャ
Hello Coders! 👋 I'm Richa, a passionate web developer on an exciting journey of creating and innovating in the digital world. 🚀🧿If you're eager to learn and grow, join me as we explore the endless possibilities in tech together!✨ Remember: "The key to excellence in any field is curiosity—never hesitate to ask questions about what you don't understand." 🙌Let’s learn, build, and succeed together!こんにちは、コーダーの皆さん!👋 私はリチャです。ウェブ開発に情熱を注ぎ、デジタルの世界で創造と革新を追求しています。🚀🧿 学び成長したい方は、一緒にテクノロジーの無限の可能性を探求しましょう! ✨ 覚えておいてください: 「どんな分野でも卓越する鍵は好奇心です。分からないことがあれば、遠慮せず質問してください。」 🙌 一緒に学び、作り上げ、成功を目指しましょう!