1️⃣ What is HTML?
Answer:
HTML (HyperText Markup Language) is the standard markup language used to create the structure of web pages. It defines elements like headings, paragraphs, links, images, and more.
2️⃣ What are HTML tags?
Answer:
HTML tags are the building blocks of HTML. They enclose content and tell the browser how to render it. Example: <p>This is a paragraph</p>
.
3️⃣ Differentiate between inline and block elements.
Answer:
- Block elements: Start on a new line and take full width (
<div>
,<p>
,<h1>
). - Inline elements: Don’t break the line and only take the required width (
<span>
,<a>
,<strong>
).
4️⃣ What are semantic elements?
Answer:
Semantic elements clearly describe their purpose (meaning) in the code. Examples: <header>
, <article>
, <footer>
, <section>
— improve SEO and accessibility.
5️⃣ How to create an HTML hyperlink?
Answer:
Use the <a>
tag:
htmlCopyEdit<a href="https://example.com">Click Here</a>
6️⃣ Define an Image Map.
Answer:
An image map allows multiple clickable areas on a single image using the <map>
and <area>
elements.
7️⃣ What are HTML attributes?
Answer:
Attributes provide additional information about elements. Example:
htmlCopyEdit<img src="image.jpg" alt="description">
8️⃣ What are lists in HTML?
Answer:
- Ordered list:
<ol>
— numbered - Unordered list:
<ul>
— bullet points - Definition list:
<dl>
— terms & descriptions
9️⃣ What are HTML comments?
Answer:
Used to insert notes or disable code:
htmlCopyEdit<!-- This is a comment -->
🔟 What are HTML forms used for?
Answer:
To collect user input and send it to the server. Uses tags like <form>
, <input>
, <textarea>
, <button>
.
1️⃣1️⃣ What are meta tags in HTML?
Answer:
Meta tags provide metadata like description, keywords, and character set, and are placed inside <head>
.
Example:
htmlCopyEdit<meta name="description" content="HTML interview questions">
1️⃣2️⃣ Define <canvas>
element in HTML5.
Answer:
Used to draw graphics and animations using JavaScript.
1️⃣3️⃣ Describe HTML layout structure.
Answer:
Modern layout uses semantic tags like:<header>
, <nav>
, <main>
, <article>
, <aside>
, <footer>
1️⃣4️⃣ What are heading tags in HTML?
Answer:
HTML has six headings: <h1>
to <h6>
— with <h1>
being the most important and <h6>
the least.
1️⃣5️⃣ What are HTML entities?
Answer:
Entities are used to display reserved characters. Example:<
displays <
,
is a space.
1️⃣6️⃣ What distinguishes HTML from HTML5?
Answer:
HTML5 includes new semantic elements, multimedia support (audio/video), offline storage, <canvas>
, and enhanced form controls.
1️⃣7️⃣ What is <!DOCTYPE>
?
Answer:
Declares the document type and HTML version to the browser. Example:
htmlCopyEdit<!DOCTYPE html>
1️⃣8️⃣ What is a style sheet?
Answer:
Style sheets (CSS) control the look and layout of HTML elements.
1️⃣9️⃣ Why is iframe
used?
Answer:
An <iframe>
embeds another HTML page within a page — often used for videos, maps, or documents.
2️⃣0️⃣ Must all HTML tags be closed?
Answer:
Yes. Except void elements like <br>
, <img>
, <hr>
which are self-closing.
2️⃣1️⃣ What are data attributes in HTML?
Answer:
Used to store extra data on elements for JavaScript use. Example:
htmlCopyEdit<div data-id="123">Item</div>
2️⃣2️⃣ What are void elements?
Answer:
Void elements don’t have closing tags. Examples: <img>
, <input>
, <hr>
, <meta>
2️⃣3️⃣ What is a marquee in HTML?
Answer:<marquee>
scrolls text or images. It’s deprecated and not recommended in modern HTML.
2️⃣4️⃣ What is HTML formatting?
Answer:
Formatting tags are used to style text:<b>
, <i>
, <strong>
, <em>
, <u>
, <mark>
, <small>
✅ Final Tip:
Practice each concept by writing real HTML code — interviewers often ask for practical examples!
🔍 SEO Keywords:
html interview questions, html5 questions and answers, web development interview html, html for freshers and students, html tag differences, semantic html vs non-semantic