Learn HTML from absolute zero and build your first complete website from scratch.
Welcome to this beginner-friendly HTML course.
This course is designed for students who have never written HTML before. You don't need previous programming knowledge.
The course follows a simple rule:
Learn → Understand → Type → Experiment → Practice → Build
By the end of this course, you should be able to open a blank HTML file and build a basic multi-page website without copying someone else's code.
- What is HTML?
- How Websites Work
- Setting Up Your Environment
- Your First HTML Page
- HTML Tags and Elements
- HTML Document Structure
- Headings and Paragraphs
- Line Breaks and Horizontal Rules
- Text Formatting
- HTML Comments
- Links
- Images
- Lists
- Tables
- HTML Attributes
- Div and Span
- File Paths
- Forms
- Input Types
- Form Controls
- HTML Validation
- Audio
- Video
- Iframe
- Semantic HTML
- HTML5 Structure
- The Head Section
- Meta Tags
- HTML Entities
- Accessibility
- Best Practices
- Common Mistakes
- Debugging HTML
- Mini Projects
- Final Project
- HTML Cheat Sheet
- Final Assessment
- What to Learn After HTML
HTML = HyperText Markup Language
HTML is the standard language used to create the structure and content of webpages.
HTML is not a programming language.
It is a markup language.
Imagine building a house.
HTML → Structure
CSS → Design
JavaScript → Behaviour
For example:
HTML
├── Heading
├── Paragraph
├── Image
├── Button
└── Form
CSS
├── Colors
├── Fonts
├── Size
└── Layout
JavaScript
├── Click actions
├── Calculations
├── Animations
└── Dynamic behaviour
We will focus on HTML first.
When you open a website:
You
↓
Browser
↓
Website files
↓
HTML
↓
Browser understands HTML
↓
Webpage appears
Common browsers:
- Google Chrome
- Microsoft Edge
- Mozilla Firefox
- Safari
HTML files normally use:
.html
Example:
index.html
about.html
contact.html
You need:
Chrome, Edge, Firefox, etc.
Recommended:
Visual Studio Code
You can also use:
- Notepad
- Notepad++
- Sublime Text
- Any online HTML editor
Create a file:
index.html
Write:
<!DOCTYPE html>
<html>
<head>
<title>My First Website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first webpage.</p>
</body>
</html>Save it.
Then open index.html in your browser.
Congratulations!
You created your first webpage.
HTML uses tags.
Example:
<p>Hello World</p>Here:
<p> Opening tag
Hello World Content
</p> Closing tag
Together they form an HTML element.
<h1>My Website</h1>h1 is the heading element.
Example:
<br><img src="photo.jpg" alt="My photo">These are called void elements.
Important void elements include:
<br>
<hr>
<img>
<input>
<meta>
<link>
<source>
<area>
<base>
<embed>
<param>
<wbr>
You don't need to memorize all of them immediately.
The standard basic structure is:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<!-- Visible content goes here -->
</body>
</html>Understand this properly.
Tells the browser that the document uses modern HTML.
The root element.
Contains information about the webpage.
The title displayed in the browser tab.
Contains the visible webpage content.
HTML provides six heading levels.
<h1>Main Heading</h1>
<h2>Second Heading</h2>
<h3>Third Heading</h3>
<h4>Fourth Heading</h4>
<h5>Fifth Heading</h5>
<h6>Sixth Heading</h6>Usually:
h1 → Main page heading
h2 → Major section
h3 → Subsection
h4 → Smaller subsection
<p>This is a paragraph.</p>Example:
<h1>About Me</h1>
<p>
My name is Rahul. I am an 8th class student.
I enjoy learning computers.
</p>Create a page about yourself containing:
- Your name
- Your school
- Your class
- Your hobbies
- Your favourite subject
<p>Hello<br>World</p><br> moves content to the next line.
<hr>Example:
<h1>My Website</h1>
<hr>
<p>Welcome to my website.</p>HTML provides several elements for giving meaning or emphasis to text.
<b>This is bold text.</b><strong>This is important.</strong><strong> has semantic meaning.
<i>This is italic text.</i><em>This text is emphasized.</em><mark>Important text</mark><small>This is small text.</small><del>Old price: ₹500</del><ins>New price: ₹400</ins>H<sub>2</sub>OOutput:
H₂O
x<sup>2</sup>Output:
x²
<p>
I am learning
<strong>HTML</strong>
and I really <em>enjoy</em> it.
</p>Comments are not displayed on the webpage.
<!-- This is a comment -->Example:
<!-- Website header starts here -->
<h1>My Website</h1>Comments are useful for organizing large HTML files.
Links are created using <a>.
<a href="https://www.google.com">
Google
</a><a href="https://www.google.com" target="_blank">
Open Google
</a><a href="mailto:example@gmail.com">
Send Email
</a><a href="tel:+911234567890">
Call Us
</a>Suppose you have:
index.html
about.html
Then:
<a href="about.html">
About Me
</a><a href="#contact">
Contact
</a>
<section id="contact">
<h2>Contact Me</h2>
</section>Use:
<img src="photo.jpg" alt="My photo">src → image location
alt → alternative text
<img
src="photo.jpg"
alt="Mountain"
width="400"
height="300"
>Suppose:
website/
│
├── index.html
│
└── images/
└── mountain.jpg
Use:
<img
src="images/mountain.jpg"
alt="Mountain"
>Always try to provide useful alt text.
Good:
<img src="dog.jpg" alt="Brown dog sitting in a garden">Bad:
<img src="dog.jpg"><ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ul><ol>
<li>Wake up</li>
<li>Go to school</li>
<li>Study</li>
</ol><ul>
<li>
Programming
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
</ul>HTML also supports:
<dl>
<dt>HTML</dt>
<dd>Markup language used to structure webpages.</dd>
<dt>CSS</dt>
<dd>Language used to style webpages.</dd>
</dl>Important elements:
<dl> → Description list
<dt> → Term
<dd> → Description
Basic table:
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>Class</th>
</tr>
<tr>
<td>Rahul</td>
<td>13</td>
<td>8</td>
</tr>
<tr>
<td>Aman</td>
<td>14</td>
<td>8</td>
</tr>
</table><table> → Table
<tr> → Table row
<th> → Table heading
<td> → Table data
<table border="1">
<tr>
<th>Name</th>
<th>Marks</th>
</tr>
<tr>
<td colspan="2">Total Students: 20</td>
</tr>
</table><table border="1">
<tr>
<th rowspan="2">Class 8</th>
<td>Rahul</td>
</tr>
<tr>
<td>Aman</td>
</tr>
</table>HTML also supports:
<table>
<caption>Student Marks</caption>
<thead>
<tr>
<th>Name</th>
<th>Math</th>
<th>Science</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rahul</td>
<td>90</td>
<td>85</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">End of table</td>
</tr>
</tfoot>
</table>Attributes provide additional information about an element.
Example:
<a href="https://google.com" target="_blank">
Google
</a>Here:
href → Attribute
target → Attribute
Important attributes to know:
id
class
title
style
href
src
alt
width
height
name
value
placeholder
required
disabled
readonly
checked
selected
min
max
minlength
maxlength
<h1 id="main-title">
My Website
</h1>An id should identify a specific element.
<p class="important">
This is important.
</p>Classes are commonly used by CSS and JavaScript.
<p title="This is additional information">
Hover over me.
</p>div is a general-purpose block container.
<div>
<h2>About Me</h2>
<p>
I am a student.
</p>
</div>span is an inline container.
<p>
My favourite color is
<span>blue</span>.
</p>Remember:
div → Block-level container
span → Inline container
Understanding file paths is essential.
Suppose:
website/
│
├── index.html
│
├── about.html
│
└── images/
└── photo.jpg
From index.html:
<img src="images/photo.jpg"><a href="pages/about.html">
About
</a>Suppose:
website/
│
├── index.html
│
└── pages/
└── about.html
From about.html:
<a href="../index.html">
Home
</a>.. means:
Go to the parent directory.
Forms collect information from users.
Basic form:
<form>
<label>Name:</label>
<input type="text">
<br><br>
<label>Email:</label>
<input type="email">
<br><br>
<input type="submit">
</form>HTML provides many input types.
<input type="text"><input type="password"><input type="email"><input type="number"><input type="date"><input type="time"><input type="file"><input type="checkbox"><input type="radio"><input type="color"><input type="range"><input type="search"><input type="url"><input type="tel"><input type="submit"><input type="reset">Correct form structure:
<label for="name">
Name:
</label>
<input
type="text"
id="name"
>The for value connects with the input's id.
<input
type="text"
placeholder="Enter your name"
><p>Select your gender:</p>
<label>
<input type="radio" name="gender" value="male">
Male
</label>
<label>
<input type="radio" name="gender" value="female">
Female
</label>The same name groups the radio buttons.
<p>Select your hobbies:</p>
<label>
<input type="checkbox" name="hobby">
Cricket
</label>
<label>
<input type="checkbox" name="hobby">
Gaming
</label>
<label>
<input type="checkbox" name="hobby">
Reading
</label><label for="city">
Choose your city:
</label>
<select id="city">
<option>Delhi</option>
<option>Kolkata</option>
<option>Mumbai</option>
<option>Patna</option>
</select><label for="message">
Message:
</label>
<textarea
id="message"
rows="5"
cols="30"
></textarea><button type="button">
Click Me
</button>Submit:
<button type="submit">
Submit
</button>Reset:
<button type="reset">
Reset
</button>HTML can perform basic form validation.
<input type="text" required>The user cannot submit the form without filling it.
<input type="email" required><input
type="number"
min="1"
max="100"
><input
type="text"
minlength="3"
><input
type="text"
maxlength="20"
>HTML can also use patterns:
<input
type="text"
pattern="[A-Za-z]+"
><audio controls>
<source
src="music.mp3"
type="audio/mpeg"
>
Your browser does not support audio.
</audio>Useful attributes:
controls
autoplay
loop
muted
<video
width="500"
controls
>
<source
src="video.mp4"
type="video/mp4"
>
Your browser does not support video.
</video>Useful attributes:
controls
autoplay
loop
muted
poster
width
height
An iframe embeds another document or supported external content.
Example:
<iframe
src="https://example.com"
width="600"
height="400">
</iframe>You may also encounter iframes when embedding:
- YouTube videos
- Maps
- Other external content
Semantic elements tell us what different parts of a webpage mean.
Important semantic elements:
<header>
<nav>
<main>
<section>
<article>
<aside>
<footer>
<figure>
<figcaption>
<address>
<time>
<body>
<header>
<h1>My Website</h1>
</header>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="contact.html">Contact</a>
</nav>
<main>
<section>
<h2>About Me</h2>
<p>
I am an 8th class student.
</p>
</section>
<section>
<h2>My Hobbies</h2>
<p>
I enjoy cricket and programming.
</p>
</section>
</main>
<footer>
<p>© 2026 My Website</p>
</footer>
</body>A complete modern HTML page can look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
>
<title>My Website</title>
</head>
<body>
<header>
<h1>My Website</h1>
</header>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About</a>
</nav>
<main>
<section>
<h2>Welcome</h2>
<p>
Welcome to my website.
</p>
</section>
</main>
<footer>
<p>© 2026 My Website</p>
</footer>
</body>
</html>The <head> contains information about the document.
Common elements:
<head>
<title>My Website</title>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
>
<meta
name="description"
content="My personal website"
>
</head>Later, CSS and external resources are also commonly connected here.
<meta charset="UTF-8">This allows the browser to correctly interpret many characters.
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
>This is important for mobile-friendly webpages.
<meta
name="description"
content="A personal website created using HTML."
>Sometimes special characters need to be represented using entities.
< <
> >
& &
space
" "
' '
© ©
® ®
Example:
<p>
Copyright © 2026
</p>A good webpage should be usable by as many people as possible.
Good:
<h1>My School</h1>
<h2>About Our School</h2>
<h2>Our Teachers</h2>Don't randomly use headings just because they look large.
<img
src="school.jpg"
alt="Front view of our school building"
>Good:
<label for="email">
Email:
</label>
<input
type="email"
id="email"
>Prefer:
<header>
<nav>
<main>
<section>
<footer>when those elements accurately describe the content.
Follow these rules.
Prefer:
<h1>Hello</h1>Instead of:
<H1>Hello</H1>Bad:
<body><h1>Hello</h1><p>Hello World</p></body>Good:
<body>
<h1>Hello</h1>
<p>
Hello World
</p>
</body>Good:
<section id="about">Bad:
<section id="x1">Good:
<p>Hello</p>HTML provides structure.
CSS should handle most visual styling.
Forgetting closing tags:
<p>HelloBetter:
<p>Hello</p>Wrong nesting:
Bad:
<p>
<strong>Hello
</p>
</strong>Good:
<p>
<strong>Hello</strong>
</p>Wrong image path
<img src="photo.jpg">when the image is actually:
images/photo.jpg
Correct:
<img src="images/photo.jpg">Forgetting quotes around attributes
Bad:
<a href=https://google.com>Good:
<a href="https://google.com">Using <br> everywhere to create spacing
Don't use:
<br><br><br><br><br>for layout.
CSS should handle spacing.
Errors are normal.
When something doesn't work:
Read your code carefully.
Check:
- Closing tags
- Quotes
- File names
- Folder names
- Image paths
- Link paths
- Attribute spelling
Open browser developer tools.
Usually:
Right Click → Inspect
Then look at:
Console
Elements
Take:
<h1>My Website</h1>
<p>This is my website.
<img src="photo.png" alt="My photo">
<a href="about.html">About Me</a>Find what is wrong.
Answer:
The paragraph is not closed.
Correct:
<h1>My Website</h1>
<p>
This is my website.
</p>
<img
src="photo.png"
alt="My photo"
>
<a href="about.html">
About Me
</a>Don't move forward without practicing.
Create:
my-introduction/
└── index.html
Must contain:
- Your name
- Your class
- Your school
- A paragraph about yourself
- Favourite subject
- Hobbies
Create a webpage containing:
- Favourite food
- Favourite sport
- Favourite game
- Favourite movie
- Favourite subject
Use:
- Headings
- Paragraphs
- Lists
- Images
- Links
Create:
student-marks/
└── index.html
Table should contain:
Name
English
Math
Science
Computer
Total
Create:
registration-form/
└── index.html
Include:
- Name
- Password
- Phone
- Date of birth
- Gender
- Hobbies
- Class
- City
- Address
- Submit
- Reset
Use validation wherever appropriate.
Create:
profile/
│
├── index.html
└── images/
└── profile.jpg
Include:
- Profile image
- Name
- Introduction
- Education
- Hobbies
- Skills
- Favourite subjects
- Contact information
Create:
school-website/
│
├── index.html
├── about.html
├── teachers.html
├── students.html
├── contact.html
└── images/
Every page should have navigation.
This is the final HTML challenge.
The student must build the entire project independently.
my-personal-website/
│
├── index.html
├── about.html
├── hobbies.html
├── gallery.html
├── contact.html
│
├── images/
│ ├── profile.jpg
│ ├── hobby.jpg
│ └── gallery1.jpg
│
└── media/
├── video.mp4
└── music.mp3
index.html
Must contain:
- Header
- Website title
- Navigation
- Introduction
- Profile image
- About section
- Hobbies section
- Link to other pages
- Footer
Example structure:
<header>
<h1>My Personal Website</h1>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="hobbies.html">Hobbies</a>
<a href="gallery.html">Gallery</a>
<a href="contact.html">Contact</a>
</nav>
</header>
<main>
<section>
<h2>Hello!</h2>
<p>
Welcome to my personal website.
</p>
<img
src="images/profile.jpg"
alt="My profile photo"
width="250"
>
</section>
</main>
<footer>
<p>© 2026 My Website</p>
</footer>about.html
Include:
- About yourself
- Education
- Goals
- Favourite subjects
- Skills
hobbies.html
Include:
- Favourite hobbies
- Ordered/unordered lists
- Images
- Descriptions
gallery.html
Include:
- At least 6 images
- Meaningful
alttext - Image captions
Example:
<figure>
<img
src="images/gallery1.jpg"
alt="Mountain landscape"
width="300"
>
<figcaption>
My favourite mountain view
</figcaption>
</figure>contact.html
Create a complete form:
<form>
<label for="name">
Name:
</label>
<input
type="text"
id="name"
name="name"
required
>
<br><br>
<label for="email">
Email:
</label>
<input
type="email"
id="email"
name="email"
required
>
<br><br>
<label for="message">
Message:
</label>
<textarea
id="message"
name="message"
rows="5"
required
></textarea>
<br><br>
<button type="submit">
Send
</button>
</form><!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html><h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<p>
<br>
<hr>
<b>
<strong>
<i>
<em>
<mark>
<small>
<del>
<ins>
<sub>
<sup><a>Important attributes:
href
target
download
<img>Important attributes:
src
alt
width
height
<ul>
<ol>
<li>
<dl>
<dt>
<dd><table>
<caption>
<thead>
<tbody>
<tfoot>
<tr>
<th>
<td>Important attributes:
colspan
rowspan
<div>
<span><header>
<nav>
<main>
<section>
<article>
<aside>
<footer>
<figure>
<figcaption>
<address>
<time><form>
<label>
<input>
<textarea>
<select>
<option>
<button>
<fieldset>
<legend>
<datalist>
<output><audio>
<video>
<source>
<track>
<iframe><head>
<title>
<meta>
<link>
<style>
<base>Before saying:
"I have completed HTML."
You should be able to answer YES to all of these.
- I know what HTML is.
- I know the difference between HTML, CSS and JavaScript.
- I understand tags and elements.
- I understand opening and closing tags.
- I understand the basic HTML document structure.
- I can create headings.
- I can create paragraphs.
- I can format text.
- I can use lists.
- I can use comments.
- I can create links.
- I can link different HTML pages.
- I can open a link in another tab.
- I can add images.
- I understand
srcandalt.
- I can create tables.
- I understand rows and columns.
- I can use
thead,tbodyandtfoot. - I understand
colspan. - I understand
rowspan.
- I can create forms.
- I can create text inputs.
- I can create email inputs.
- I can create password inputs.
- I can create radio buttons.
- I can create checkboxes.
- I can create dropdowns.
- I can create textareas.
- I can create submit/reset buttons.
- I understand
label. - I can use basic HTML validation.
- I understand
div. - I understand
span. - I understand semantic HTML.
- I can create a header.
- I can create navigation.
- I can create sections.
- I can create a footer.
- I can add audio.
- I can add video.
- I understand iframe.
- I understand folders.
- I understand relative paths.
- I can connect multiple HTML pages.
- I can organize images and media.
- I use meaningful
alttext. - I use labels for forms.
- I use headings logically.
- I understand why semantic HTML matters.
Most importantly:
- I can create a webpage without following a tutorial.
- I can find and fix basic HTML errors.
- I can build a multi-page website independently.
- I can explain what my HTML code does.
Don't learn HTML by memorizing tags.
Learn HTML by asking:
"What does this content mean?"
For example:
If you need a main heading:
<h1>My School</h1>If you need a paragraph:
<p>My school is a wonderful place.</p>If you need a navigation link:
<a href="about.html">About</a>If you need an image:
<img src="school.jpg" alt="Our school">If you need a list:
<ul>
<li>Math</li>
<li>Science</li>
<li>Computer</li>
</ul>HTML becomes much easier when you think about meaning instead of memorization.
Copying code can make a webpage appear to work while teaching you almost nothing.
For every example:
- Read it.
- Understand it.
- Type it yourself.
- Change something.
- Break something intentionally.
- Fix it.
- Build your own version.
If you can only build the webpage while looking at the tutorial, you haven't learned it yet.
The final goal isn't:
"I know 100 HTML tags."
The final goal is:
Give me a blank folder and a blank HTML file, and I can create a working website myself.
Once you can do that, you're ready for the next stage:
HTML
↓
CSS
↓
Responsive Design
↓
JavaScript
↓
Git & GitHub
↓
Real Projects
After completing this course, start learning:
Learn:
- Colors
- Fonts
- Borders
- Margins
- Padding
- Box model
- Flexbox
- Grid
- Positioning
- Responsive design
- Animations
- Media queries
Learn:
- Variables
- Data types
- Conditions
- Loops
- Functions
- Arrays
- Objects
- DOM
- Events
- Forms
- APIs
Learn:
- Repository
- Commit
- Push
- Pull
- Branch
- GitHub Pages
Then start building real projects.
This repository is designed around one idea:
Don't just consume tutorials. Build things.
Every topic should eventually become a project.
Every project should eventually become something you can show someone.
And every mistake should become something you understand.
Close this README.
Open VS Code.
Create:
index.html
Don't search for a template.
Don't copy the final project.
Don't ask someone for the code.
Start with:
<!DOCTYPE html>and build your own website.
If you can do that successfully, you have actually learned HTML.
HTML Beginner → Intermediate
Progress:
[ ] Not Started
[ ] Basics
[ ] Content
[ ] Forms
[ ] Media
[ ] Semantic HTML
[ ] Accessibility
[ ] Mini Projects
[ ] Final Project
[ ] Independent Website
HTML Learning Repository
Built to make HTML understandable for beginners and practical enough to create real websites.
Learn → Practice → Build → Break → Fix → Repeat.