HTML Topic1 Introduction To HTML
HTML Topic1 Introduction To HTML
Introduction
to HTML
Structure · Tags · Attributes · Comments
— Mini Projects
— Final Test
— Answer Key
Fig 1.1a – Raw data (binary) is structured by HTML tags and rendered as a visual webpage in the browser.
HTML stands for HyperText Markup Language. It is the universal language used to create and
structure content on the World Wide Web. Every webpage you visit — a news article, a social media
feed, an online store, or a blog — is built on a foundation of HTML.
LIGHTBULB TIP
Think of HTML as the SKELETON of a webpage.
Just like a skeleton gives structure to the human body, HTML gives structure to a page.
CSS adds style (the skin), and JavaScript adds behaviour (the muscles).
Fig 1.1b – HTML code displayed holographically, showing how tags like , , form a structured document.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 2
Breaking Down the Full Form:
HyperText Beyond / Super text Links that jump between pages (hyperlinks)
Language A set of rules HTML has its own grammar and syntax rules
FUN FACT
FUN FACT: HTML was invented by Tim Berners-Lee, a British scientist at CERN in 1991.
He needed a way for scientists to share documents across the world.
The very first website is still live today at: [Link]
MCQ Questions:
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 3
Q2 HTML is best described as a __________.
A) Programming Language
B) Database Language
C) Markup Language
D) Scripting Language
A) Bill Gates
B) Linus Torvalds
C) Tim Berners-Lee
D) Mark Zuckerberg
A) Create a heading
B) Add an image
D) Write a paragraph
Practice Problems:
■ P1 — Explain what HTML does on a web page in your own words. (2-3 sentences)
■ P3 — Create a comparison table: Language | Role | Example. Fill it for HTML, CSS, JavaScript.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 4
1.2 HTML History and Versions
Fig 1.2a – HTML has evolved through many versions since 1991, each adding more power to web development.
HTML has evolved significantly since its creation. Understanding its history helps you appreciate why
things work the way they do — and why HTML5 is such a powerful upgrade over earlier versions.
HTML 1.0 1991 First version. ~18 tags. Basic text and hyperlinks only.
HTML 2.0 1995 First official standard. Added forms and image support.
HTML 3.2 1997 Added tables, Java applets, text flow around images.
HTML 4.01 1999 CSS support, frames, scripting, improved forms. Used for a decade.
XHTML 1.0 2000 Strict XML-based HTML — all tags must be lowercase and closed.
HTML5 2014 Current standard: audio/video, Canvas, semantic tags, Web APIs.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 5
Fig 1.2b – HTML5 brought a new era of web development: rich media, semantic layout, and powerful browser APIs.
NOTE
XHTML tried to make HTML stricter (like XML) but failed because it was too unforgiving.
HTML5 went the opposite direction — browsers are designed to handle imperfect code gracefully.
Always write clean HTML anyway — valid code is faster and works on more devices!
A) 1985
B) 1991
C) 1999
D) 2004
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 6
Q6 Which HTML version is the current living standard?
A) HTML 4.01
B) XHTML 1.0
C) HTML5
D) HTML 3.2
D) Table support
Practice Problems:
■ P2 — List THREE features HTML5 added that HTML4 did not have.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 7
1.3 Setting Up the Environment
The beauty of HTML is that you need almost nothing to get started — just a text editor and a web
browser. Both are already on your computer! However, a professional code editor makes the process
much faster and helps you avoid mistakes.
VS Code (RECOMMENDED) Win / Mac / Linux All levels — best choice Free
LIGHTBULB TIP
We strongly recommend VS Code (Visual Studio Code) by Microsoft — it is FREE.
It works on Windows, Mac, and Linux, and is used by millions of professionals daily.
Download it at: [Link]
● Live Server — Auto-refreshes your browser every time you save the HTML file.
● Prettier — Automatically formats your code to look clean and consistent.
● HTML CSS Support — Auto-completes HTML tags and CSS properties as you type.
● Auto Rename Tag — Changing an opening tag automatically updates the closing tag.
Step 3 — Create Your First HTML File:
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 8
Chrome-based, good on
Microsoft Edge F12
Windows
WARNING
Always test in at least TWO browsers — Chrome and Firefox is a great combination.
Press F12 in any browser to open Developer Tools and inspect your HTML live.
A) Ctrl+D
B) F12
C) Ctrl+H
D) Alt+F4
Q10 What is the standard name for a website's first / home page?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
Practice Problems:
■ P2 — Create [Link], type ! then Tab. Write exactly what VS Code generates.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 9
■ P3 — Why should you test HTML in multiple browsers? Give a real-world example.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 10
1.4 HTML Document Structure
Fig 1.4a – The HTML document as glowing stacked blocks: at the top, then wrapping (metadata) and (visible content).
Every HTML document follows the same basic skeleton — no matter how simple or complex the page
is. Think of it like building a house: there is always a foundation, walls, and rooms. Learning this
skeleton is the FIRST thing every web developer must master.
HTML
1 <!DOCTYPE html>
2 <html lang="en">
3
4 <head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>My First Webpage</title>
8 </head>
9
10 <body>
11 <h1>Hello, World!</h1>
12 <p>This is my very first webpage.</p>
13 </body>
14
15 </html>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 11
Fig 1.4b – The HTML parsing sequence: Declaration → Root Container (html) → Metadata (head) + Visible Content
(body) → Browser renders the page.
Line-by-Line Explanation:
<!DOCTYPE html> Tells browser this is HTML5. Must be the very first line. No
<title>...</title> Text shown in browser tab, bookmarks, Google results. Tab only
<body> Everything the user SEES — text, images, forms, videos. Yes
IMPORTANT
IMPORTANT: The <head> is the BRAIN — invisible but very important.
The <body> is the FACE — everything users can see and interact with.
NEVER put visible content (text, images, buttons) inside the <head> section!
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 12
HTML
1 <!-- CORRECT: Inner tag closes before outer tag closes -->
2 <p><strong>This is bold text inside a paragraph.</strong></p>
3
4 <!-- WRONG: Tags overlap — this is INVALID HTML -->
5 <p><strong>Wrong nesting</p></strong>
6
7 <!-- TIP: Use 2-space or Tab indentation for nested elements -->
8 <body>
9 <div>
10 <p>Each level is indented. This makes code readable!</p>
11 </div>
12 </body>
Q11 Which line MUST appear at the very top of an HTML5 document?
A) <html>
B) <!DOCTYPE html>
C) <head>
D) <meta charset="UTF-8">
Q12 Where should you place the visible content of your webpage?
A) Inside <head>
B) Inside <meta>
C) Inside <body>
D) Inside <title>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 13
Q14 What does lang="en" tell the browser?
Practice Problems:
■ P1 — Write the complete HTML5 skeleton from memory. Include all essential tags.
■ P3 — What happens if you forget the DOCTYPE? Research and explain in 2 sentences.
■ P4 — Create an HTML file with your name as title, h1 heading "About Me", paragraph about
yourself.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 14
1.5 HTML Elements and Tags
Fig 1.5 – HTML elements are the fundamental building blocks of every webpage. Each tag — h1, p, div, img — wraps a
specific type of content.
Understanding the exact difference between a Tag and an Element is fundamental. Many beginners
confuse them — let's clear this up once and for all.
HTML
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 15
Self-Closing (Void) Elements:
Some HTML elements have no content and no closing tag. They are called void elements or
self-closing elements.
HTML
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 16
EXERCISE 1.5 — Elements and Tags (Answers on the last page)
A) <p>
B) <div>
C) <img>
D) <section>
A) <h6>
B) <heading>
C) <h1>
D) <big>
Practice Problems:
■ P2 — From this list, identify which are void: div, br, span, img, input, p
■ P3 — Write HTML with heading "My Hobbies" and 3 paragraphs about different hobbies.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 17
1.6 HTML Attributes
Fig 1.6 – Attributes (id, class, href) are like connectors that plug extra configuration into HTML elements, controlling their
behaviour and identity.
If HTML elements are the building blocks, then attributes are the settings and properties of those
blocks. Attributes provide extra information to elements — such as where to find an image, where a
link should go, or how wide something should be.
HTML
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 18
● Boolean attributes (required, disabled, checked) need no value — just the name.
● Attribute names should always be lowercase (standard practice).
Global Attributes — Work on ANY HTML Element:
style Applies inline CSS style directly to the element. <p style="color:red">
title Shows a tooltip when hovering over the element. <img title="Logo">
data-* Custom data attributes for storing extra info. <div data-id="42">
WARNING
The id attribute MUST be unique — no two elements on the same page can share the same id.
The class attribute CAN be shared by many elements — that is its purpose.
Rule: id = ONE specific element. class = GROUP of similar elements.
A) A tag
B) An element
C) An attribute
D) A value
A) class
B) name
C) id
D) title
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 19
Q20 Which of the following is a BOOLEAN attribute?
A) href
B) src
C) alt
D) required
Practice Problems:
■ P1 — Write an img tag: loads [Link], alt "Beautiful sunset", 400px wide, lazy loading.
■ P3 — What is the difference between id and class? Give one code example of each.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 20
1.7 HTML Comments
An HTML comment is a note inside your code that the browser completely ignores. Comments are
visible only to developers looking at the source code. Writing good comments is one of the most
important professional habits you can build.
Comment Syntax:
HTML
Leave a TODO reminder [!-- TODO: Add contact form here --]
Explain tricky code [!-- This loop generates all product cards --]
Warn other developers [!-- WARNING: Do not change the id below! --]
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 21
HTML
1 <!DOCTYPE html>
2 <html lang="en">
3
4 <head>
5 <!-- === PAGE SETTINGS === -->
6 <meta charset="UTF-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1.0">
8 <title>My Portfolio</title>
9 <link rel="stylesheet" href="[Link]">
10 </head>
11
12 <body>
13
14 <!-- ===== HEADER SECTION ===== -->
15 <header>
16 <h1>Jane Doe</h1>
17 <p>Full Stack Web Developer</p>
18 </header>
19
20 <!-- ===== MAIN NAVIGATION ===== -->
21 <nav>
22 <a href="#about">About</a>
23 <a href="#projects">Projects</a>
24 <!-- TODO: Add Blog link when blog is ready -->
25 <a href="#contact">Contact</a>
26 </nav>
27
28 </body>
29 </html>
WARNING
NEVER put passwords, API keys, or secret information inside HTML comments!
Anyone can press Ctrl+U (View Source) in any browser and read all your comments.
Comments are also visible in the F12 Developer Tools panel.
A) // This is a comment
B) /* This is a comment */
D) # This is a comment
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 22
Q23 What does the browser do when it sees an HTML comment?
C) Completely ignores it
Practice Problems:
■ P1 — Add 5 meaningful comments to a basic HTML page with header, nav, and body.
■ P2 — Comment out the second paragraph so it does not show: [p]Visible[/p] [p]Hide this[/p]
[p]Also visible[/p]
■ P4 — Write a fully commented version of the HTML skeleton from section 1.4.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 23
MINI PROJECTS — Topic 1
Goal: Create a complete, valid HTML5 page using all core concepts from Topic 1. Build it about
something you love — a favourite game, food, sport, or hobby!
Requirements Checklist:
HTML
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <!-- Add meta tags and title here -->
5 </head>
6 <body>
7 <!-- Add your content here -->
8
9 </body>
10 </html>
Bonus Challenges:
Goal: Build a structured personal profile page using all seven subtopics. This should be a page you
could genuinely show to others!
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 24
● Header: Your name (h1), a tagline (p), profile photo (img with alt).
● About Section: h2 heading, 2-3 paragraphs describing yourself.
● Skills Section: h2 heading, list your top 5 skills using ul and li.
● Contact Section: h2 heading, email link ([Link] optional phone ([Link]
● Attributes: id on each section, class on 3+ elements, title on the photo.
● Comments: Label every major section with a clear HTML comment.
● Metadata: A description meta tag mentioning your name and skills.
Grading Rubric:
Criteria Points
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 25
FINAL TEST — Topic 1: Introduction to HTML
Circle the correct letter. Do NOT look at the Answer Key yet!
A) Programming
B) Markup
C) Database
D) Scripting
A) <head>
B) <meta>
C) <html>
D) <body>
A) <div>
B) <p>
C) <br>
D) <section>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 26
Q4 The <!DOCTYPE html> declaration must appear __________.
A) Inside <head>
B) Inside <body>
C) Before <html>
D) After <html>
A) Closing
B) Opening
C) Body
D) Head
A) disabled
B) readonly
C) required
D) checked
A) // comment
B) /* comment */
D) # comment
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 27
Q9 Which attribute uniquely identifies ONE element on the page?
A) class
B) id
C) name
D) type
C) As a heading on screen
D) In the footer
A) HTML 4.01
B) XHTML 1.0
C) HTML 3.2
D) HTML5
A) <h1>
B) <h3>
C) <h6>
D) <small>
A) Notepad
B) VS Code
C) Microsoft Word
D) Excel
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 28
Q14 What does lang="en" in <html lang="en"> tell the browser?
Q15 Where should you NEVER store sensitive information like passwords?
A) In the <body>
B) In a <p> tag
C) In HTML comments
D) In the <head>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 29
PART B — Short Answer (5 marks each)
■ B1. Explain the difference between <head> and <body>. What content belongs in each? Give
TWO examples for each.
■ B2. What is the difference between an HTML Element and an HTML Attribute? Show a code
example with BOTH.
■ B3. Name and briefly explain FIVE features that HTML5 added which HTML4 lacked.
■ B4. What are "boolean attributes"? Give THREE examples and explain what each does.
■ B5. Why is writing HTML comments important? List FOUR specific situations where they are
useful.
■ C1. Write a COMPLETE valid HTML5 document for a "Restaurant Menu" page. Include:
DOCTYPE, html with lang, head with charset + viewport + title, body with: h1 heading, TWO h2
section headings, at least two p food items per section, one img with alt, a link to
"[Link]". Add comments for each section.
■ C2. Create an HTML "User Registration" form with: full name (text, required), email (email,
required), age (number, min=13, max=120), password (password, required, minlength=8), terms
checkbox (required), and a submit button. All inputs must have labels and proper attributes.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 30
■ C3. Create a page "My Learning Journey" with: proper HTML5 structure, at least 5 different
HTML elements, at least 4 different attributes, 3 section comments, and a table with columns: Topic
| What I Learned | Difficulty.
Find ALL errors. Write the corrected version below each snippet.
HTML
1 <DOCTYPE html>
2 <HTML lang=EN>
3 <head>
4 <title>My Page</title>
5 <body>
6 <H1>Welcome</H1>
7 <img src="[Link]">
8 <a href=[Link] target="blank">Google</A>
9 <!-- This is a comment ->
10 </body>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 31
HTML
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charSet="utf-8">
5 <meta name="viewport content="width=device-width">
6 </head>
7 <body>
8 <p><strong>Bold Text</p></strong>
9 <img alt="Logo" widht="200">
10 <input type="email" require>
11 </body>
12 </html>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 32
ANSWER KEY — Topic 1: Introduction to HTML
WARNING
Check answers ONLY after attempting ALL questions yourself.
Looking at answers before trying significantly reduces your learning.
Be honest with yourself — that is the foundation of real skill-building!
Ex 1.1 Q1 Answer: B
HyperText Markup Language — the full form.
Ex 1.1 Q2 Answer: C
HTML describes structure — it is a Markup Language.
Ex 1.1 Q3 Answer: C
Tim Berners-Lee created HTML at CERN in 1991.
Ex 1.1 Q4 Answer: C
Form validation logic requires JavaScript — HTML alone cannot do it.
Ex 1.2 Q5 Answer: B
HTML 1.0 was created in 1991 by Tim Berners-Lee.
Ex 1.2 Q6 Answer: C
HTML5 (2014) is the current standard, now a Living Standard.
Ex 1.2 Q7 Answer: B
HTML5 added native audio/video support — no Flash plugin needed.
Ex 1.3 Q8 Answer: B
F12 opens Developer Tools in Chrome, Firefox, and Edge.
Ex 1.3 Q9 Answer: B
Live Server auto-refreshes the browser every time you save.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 33
Ex 1.5 Q16 Answer: C
Element = opening tag + content + closing tag (all three parts).
FT Q1 Answer: B
Markup — HTML describes structure, not logic or calculation.
FT Q2 Answer: D
body — all visible content lives inside the body tag.
FT Q3 Answer: C
br is a void/self-closing element (no closing tag).
FT Q4 Answer: C
!DOCTYPE html must come before anything — even the html tag.
FT Q5 Answer: B
Opening tag — attributes are always placed in the opening tag.
FT Q6 Answer: C
required makes a field mandatory before form can be submitted.
FT Q7 Answer: B
alt provides alternative text when image fails to load.
FT Q8 Answer: C
[!-- comment --] is the correct HTML comment syntax.
FT Q9 Answer: B
id must be unique — no two elements share the same id on a page.
FT Q10 Answer: B
title content appears in the browser tab, not in the page body.
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 34
FT Q11 Answer: D
HTML5 is the current living standard.
FT Q12 Answer: C
h6 = smallest heading; h1 = largest heading.
FT Q13 Answer: B
VS Code is free, cross-platform, and used by millions of professionals.
FT Q14 Answer: B
en is the ISO language code for English.
FT Q15 Answer: C
HTML comments are visible in View Source — never store secrets there!
HTML
HTML
1 <!DOCTYPE html>
2 <html lang="en"> FIX 1: lang attribute was missing
3 <head>
4 <meta charset="utf-8"> FIX 2: charSet -> charset (lowercase)
5 <meta name="viewport" content="width=device-width">
6 FIX 3: missing closing quote after "viewport
7 </head>
8 <body>
9 <p><strong>Bold Text</strong></p> FIX 4: wrong nesting — fixed order
10 <img alt="Logo" width="200"> FIX 5: widht typo -> width
11 <input type="email" required> FIX 6: require -> required
12 </body>
13 </html>
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 35
Congratulations on completing Topic 1! You now know the foundational building blocks of every website
on the internet. Google, YouTube, Netflix — they all use these exact same HTML structures. Next up:
Topic 2 — Basic Text Formatting
HTML MASTERY NOTES | Topic 1: Introduction to HTML © HTML Mastery Series Page 36