H

HTML Handbook

Clean • Professional

Introduction to HTML — Interview Questions & Answers

3 minute

Introduction to HTML — Interview Questions & Answers

1. What is HTML

Ques: What does HTML stand for?

Ans: HTML stands for HyperText Markup Language, the standard language used to create and structure web pages.

Ques: Is HTML a programming language?

Ans: No, HTML is a markup language. It structures content but doesn’t perform logic or computation.

Ques: What is the main purpose of HTML?

Ans: It defines the structure and content of a web page using elements like headings, paragraphs, links, and images.

2. Founder of HTML & When It Was Invented

Ques: Who invented HTML and when?

Ans: Tim Berners-Lee, a British scientist at CERN, in 1991.

Ques: Why was HTML created?

Ans: To enable scientists to share and link research documents easily over the internet.

3. Why We Need HTML & Its Importance

Ques: Why is HTML essential in web development?

Ans: HTML provides the foundation of all web pages — browsers rely on it to understand and display structured content.

Ques: How does HTML work with CSS and JavaScript?

Ans: HTML structures content, CSS styles it, and JavaScript adds interactivity.

4. History & Evolution of HTML

Ques: How has HTML evolved over time?

Ans:

  • HTML 1.0 (1991): Basic text and links
  • HTML 2.0 (1995): Forms and tables
  • HTML 3.2 (1997): Multimedia support
  • HTML 4.01 (1999): CSS integration
  • XHTML (2000): XML-based structure
  • HTML5 (2014): Multimedia, APIs, semantic elements

5. Versions of HTML

Ques: What are the main versions of HTML?

Ans: HTML 1.0, 2.0, 3.2, 4.01, XHTML, and HTML5.

Ques: Which is the latest version of HTML?

Ans: HTML5, standardized by W3C in 2014 and maintained as a living standard by WHATWG.

6. Difference Between HTML & HTML5

FeatureHTMLHTML5
MultimediaNeeds plugins (Flash)Supports <audio> & <video>
Semantic TagsLimited<header>, <footer>, <article>, etc.
APIsNoneGeolocation, Web Storage, Canvas
DoctypeLong and complexSimplified <!DOCTYPE html>
Browser SupportOlder browsersModern browsers

Ques: Why is HTML5 preferred today?

Ans: It’s faster, supports multimedia, improves SEO, and ensures better cross-device compatibility.

7. Doctype and Document Setup

Ques: What is the purpose of <!DOCTYPE html>?

Ans: It tells the browser to render the page in standards mode using HTML5.

Ques: Where is the <!DOCTYPE html> placed?

Ans: At the top of the HTML document, before the <html> tag.

8. Basic Structure of an HTML Page

Ques: What is the basic structure of an HTML page?

<!DOCTYPE html>
<html lang="en">
<head>
  <title>My First Page</title>
</head>
<body>
  <h1>Hello World!</h1>
</body>
</html>

Ques: What are the main sections of an HTML document?

Ans: <head> (metadata) and <body> (visible content).

9. Head Section Overview

Ques16: What is the <head> section used for?

Ans: It contains metadata, the title, and links to external files (CSS, JS) — not displayed on the page.

10. Common Head Elements

<title> – Page Title

Defines the page title shown in browser tabs and search results.

<meta> – Metadata

Used for charset, SEO description, and responsive design.

Example:

<meta charset="UTF-8">
<meta name="description" content="Learn HTML Basics">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link> – External Resources

Links external CSS, favicon, or preload resources.

Example:

<link rel="stylesheet" href="styles.css">
<link rel="icon" href="favicon.ico">

<base> – Base URL

Defines a base path for all relative links.

Example:

<base href="<https://example.com/>">

11. Script and Noscript

<script> – JavaScript Inclusion

async loads immediately, defer waits until HTML parsing completes.

Example:

<script src="app.js" async></script>
<script src="main.js" defer></script>

<noscript> – Fallback

Displays content if JavaScript is disabled.

12. How Browsers Render HTML

Ques: How does a browser render an HTML page?

Ans:

  1. Parses HTML → builds DOM Tree
  2. Loads CSS → builds CSSOM Tree
  3. Combines them → Render Tree
  4. Paints pixels on screen

13. XHTML

Ques: What is XHTML?

Ans: A stricter, XML-based version of HTML 4.01 — required lowercase tags and proper closing.

Ques: Is XHTML still used today?

Ans: Rarely; HTML5 replaced it due to more flexibility.

14. Comments in HTML

Ques: How do you add comments in HTML?

<!-- This is a comment -->

Ques: Are comments visible to users?

Ans: No, they are ignored by browsers.

Article 0 of 0