Introduction to HTML

What is HTML?

HTML stands for HyperText Markup Language.

It is used to create the structure of web pages.

HTML tells the browser:

  • What is a heading
  • What is a paragraph
  • What is an image
  • What is a link

👉 HTML is NOT a programming language.

It is a markup language.

History of HTML

  • Invented by Tim Berners-Lee
  • First version released in 1991
  • Current version: HTML5

Why HTML is used?

  • To create websites
  • To structure content
  • To connect CSS and JavaScript
  • Works on all browsers

HTML vs CSS vs JavaScript

Language Work
HTML Structure
CSS Design
JavaScript Functionality

Introduction to HTML Quiz

1. What does HTML stand for?

2. Who invented HTML?

3. What is the current version of HTML?

4. Which of the following is NOT true about HTML?

5. What is the role of CSS in web development?

HTML Basics

Structure of an HTML Document

Every HTML page has a fixed structure.

<!DOCTYPE html>
<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <h1>Hello World</h1>
  </body>
</html>

This is the output of the code

<!DOCTYPE html>

  • Tells browser this is HTML5
  • Must be written at the top

<html> tag

  • Root element of the page
  • All code stays inside it

<head> tag

Contains:

  • Title
  • Meta tags
  • CSS
  • SEO info

<body> tag

Contains:

  • Text
  • Images
  • Videos
  • Forms
  • Links

HTML Comments

Used to explain code (not visible on page)

<!-- This is a comment -->

HTML Basics Quiz

1. What is the purpose of the <!DOCTYPE html> declaration?

2. Which tag is the root element of an HTML page?

3. Which section contains the visible content of a webpage?

4. What is the correct syntax for an HTML comment?

5. Which tag is used to define the title of a document?

HTML Elements

What are HTML Elements?

HTML element = tag + content

<p>This is a paragraph</p>

This is the output of the code

Types of Elements

1. Container Elements

  • Have opening & closing tag
  • Example: <h1>Heading</h1>

2. Empty Elements

  • No closing tag
  • Example: <br>
  • Example: <img>
  • Example: <hr>

Nested Elements

Elements inside elements

<p>This is <b>bold</b> text</p>

This is the output of the code

Block vs Inline Elements

Block Elements

  • Start on new line
  • Take full width
  • Examples:<div>, <p>, <h1>

Inline Elements

  • Stay in same line
  • Take needed width
  • Examples : <span>, <a>, <b>

HTML Elements Quiz

1. What is an HTML element composed of?

2. Which of the following is a container element?

3. Which of the following is an empty element?

4. What are nested elements?

5. Which of the following is a block element?

HTML Attributes

What are Attributes?

Attributes give extra information to elements.

<img src="photo.jpg" alt="My Photo">

This is the output of the code

WhatsApp Image

Common Attributes

Attribute Work
id Unique identity
class Group elements
style Inline CSS
title Tooltip text

id Attribute

  • Must be unique
<p id="para1">Hello</p>

This is the output of the code

WhatsApp Image

class Attribute

  • Can be reused
<p class="text">Hello</p>

This is the output of the code

WhatsApp Image

Data Attributes

  • Used to store extra data
<div data-user="admin"></div>

HTML Attributes Quiz

1. What is the purpose of HTML attributes?

2. Which attribute provides a unique identity to an element?

3. Which attribute is used to group elements?

4. Which attribute is used for inline CSS?

5. Which attribute provides tooltip text?

Text Formatting Tags

Headings

<h1>Main Heading</h1>
<h6>Small Heading</h6>

This is the output of the code

ChatGPT Image

Paragraph

<p>This is a paragraph</p>

This is the output of the code

ChatGPT Image

Bold & Strong

<b>Bold</b>
<strong>Important</strong>

This is the output of the code

ChatGPT Image

Italic & Emphasis

<i>Italic</i>
<em>Emphasized</em>

This is the output of the code

ChatGPT Image

Underline

<u>Underlined text</u>

This is the output of the code

ChatGPT Image

Superscript & Subscript

H<sup>2</sup>O
CO<sub>2</sub>

This is the output of the code

ChatGPT Image

Line Break & Horizontal Line

<br>
<hr>

Text Formatting Tags Quiz

1. Which tag is used for the main heading?

2. Which tag is used to create a paragraph?

3. Which tag is used to make text bold?

4. Which tag is used to emphasize text?

5. Which tag is used to underline text?

HTML Lists

HTML lists are used to display items in a proper order.

Unordered List (<ul>)

Shows items with bullets

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

This is the output of the code

ChatGPT Image

Ordered List (<ol>)

Shows items with numbers

<ol>
  <li>Open browser</li>
  <li>Write code</li>
  <li>Save file</li>
</ol>

This is the output of the code

ChatGPT Image

Description List (<dl>)

Used for definitions

<dl>
  <dt>HTML</dt>
  <dd>Markup language for web</dd>
</dl>

This is the output of the code

ChatGPT Image

Nested List

List inside a list

<ul>
  <li>Frontend
    <ul>
      <li>HTML</li>
      <li>CSS</li>
    </ul>
  </li>
</ul>

This is the output of the code

ChatGPT Image

HTML Lists Quiz

1. Which tag is used to create an unordered list?

2. Which tag is used to create an ordered list?

3. Which tag is used to define list items?

4. Which type of list shows items with bullets?

5. Which type of list shows items with numbers?

HTML Images

Images make websites attractive.

Image Tag (<img>)

<img src="image.jpg" alt="My Image">

This is the output of the code

WhatsApp Image

Image Attributes

Attribute Work
src Image path
alt Alternate text
width Image width
height Image height

Image as a Link

<a href="home.html">
  <img src="logo.png">
</a>

This is the output of the code

ChatGPT Image

Image Paths

Same folder: image.jpg

Sub-folder: images/photo.png

HTML Images Quiz

1. Which tag is used to insert an image?

2. Which attribute is used to specify the source of an image?

3. Which attribute is used to provide alternate text for an image?

4. Which attribute is used to set the width of an image?

5. How do you make an image a link?

HTML Tables

Tables are used to display data in rows and columns.

🔹 Basic Table

<table border="1">
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Ram</td>
    <td>18</td>
  </tr>
</table>

This is the output of the code

ChatGPT Image

Table Tags

Tag Use
<table> Table
<tr> Row
<th> Heading
<td> Data

Colspan & Rowspan

<td colspan="2">Total</td>

This is the output of the code

ChatGPT Image

Table Caption

<caption>Student Data</caption>

This is the output of the code

ChatGPT Image

HTML Tables Quiz

1. Which tag is used to create a table?

2. Which tag is used to create a row in a table?

3. Which tag is used to create a header cell in a table?

4. Which tag is used to create a data cell in a table?

5. Which attribute is used to make a cell span multiple columns?

HTML Forms

Forms collect user input.

Form Tag

<form>
  Name: <input type="text">
</form>

This is the output of the code

ChatGPT Image

Input Types

<input type="text">
<input type="password">
<input type="email">
<input type="number">

This is the output of the code

ChatGPT Image

Radio Button

<input type="radio" name="gender"> Male
<input type="radio" name="gender"> Female

This is the output of the code

ChatGPT Image

Checkbox

<input type="checkbox"> HTML
<input type="checkbox"> CSS

This is the output of the code

ChatGPT Image

Textarea

<textarea rows="4" cols="30"></textarea>

Select & Option

<select>
  <option>India</option>
  <option>USA</option>
</select>

This is the output of the code

ChatGPT Image

Submit Button

<input type="submit" value="Send">

This is the output of the code

ChatGPT Image

HTML Forms Quiz

1. Which tag is used to create a form?

2. Which input type is used for a text field?

3. Which input type is used for a password field?

4. Which input type is used for radio buttons?

5. Which input type is used for checkboxes?

HTML Input Types (Detailed)

HTML provides different input types to collect specific data.

Common Input Types

<input type="text"> <!-- Text -->
<input type="password"> <!-- Password -->
<input type="email"> <!-- Email -->
<input type="number"> <!-- Numbers -->
<input type="date"> <!-- Date -->
<input type="file"> <!-- Upload file -->
<input type="color"> <!-- Pick color -->
<input type="range"> <!-- Slider -->

This is the output of the code

ChatGPT Image

Submit & Reset

<input type="submit" value="Submit">
<input type="reset" value="Reset">

This is the output of the code

ChatGPT Image

Required Attribute

<input type="text" required>

This is the output of the code

ChatGPT Image

Placeholder

<input type="text" placeholder="Enter name">

This is the output of the code

ChatGPT Image

HTML Input Types Quiz

1. Which input type is used for a date picker?

2. Which input type is used for file upload?

3. Which input type is used for a color picker?

4. Which input type is used for a slider?

5. Which input type is used for a submit button?

HTML Media (Audio & Video)

Media tags allow you to play sound and videos.

Audio Tag

<audio controls>
  <source src="song.mp3" type="audio/mp3">
</audio>

This is the output of the code

ChatGPT Image

Attributes:

  • controls
  • autoplay
  • loop
  • muted

Video Tag

<video width="400" controls>
  <source src="movie.mp4" type="video/mp4">
</video>

This is the output of the code

ChatGPT Image

Poster Images

<video poster="thumb.jpg" controls></video>

This is the output of the code

ChatGPT Image

HTML Media Quiz

1. Which tag is used to embed audio in HTML?

2. Which tag is used to embed video in HTML?

3. Which attribute is used to show controls for audio/video?

4. Which attribute is used to make audio/video play automatically?

5. Which attribute is used to make audio/video play repeatedly?

HTML Semantic Elements

Semantic elements give meaning to the page structure.

Important Semantic Tags

<header>Header section</header>
<nav>Navigation links</nav>
<main>Main content</main>
<section>Section</section>
<article>Article</article>
<aside>Side content</aside>
<footer>Footer</footer>

This is the output of the code

ChatGPT Image

Benefits

  • Better SEO
  • Better accessibility
  • Clean code

HTML Semantic Elements Quiz

1. Which semantic element is used for the header section?

2. Which semantic element is used for navigation links?

3. Which semantic element is used for the main content?

4. Which semantic element is used for an article?

5. Which semantic element is used for side content?

HTML Layout

Layout means page structure.

Div-based Layout (Old way)

<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>

This is the output of the code

ChatGPT Image

Semantic Layout (Modern)

<header></header>
<nav></nav>
<main></main>
<footer></footer>

This is the output of the code

ChatGPT Image

Responsive Layout Basics

  • Use percentages
  • Use viewport meta tag
<meta name="viewport" content="width=device-width, initial-scale=1.0">

This is the output of the code

ChatGPT Image

HTML Layout Quiz

1. What does layout mean in web design?

2. Which element was commonly used for layout in the old way?

3. Which semantic element is used for the header in modern layout?

4. Which semantic element is used for the main content in modern layout?

5. Which of the following is a mobile-friendly tip?

HTML Iframes

Iframe embeds another webpage.

Basic Iframe

<iframe src="page.html"></iframe>

This is the output of the code

ChatGPT Image

YouTube Video Embed

<iframe src="https://www.youtube.com/embed/videoID"></iframe>

This is the output of the code

ChatGPT Image

Google Map Embed

<iframe src="map_link"></iframe>

This is the output of the code

ChatGPT Image

Security Attributes

<iframe sandbox></iframe>

This is the output of the code

ChatGPT Image

HTML Iframes Quiz

1. What is an iframe used for?

2. Which tag is used to create an iframe?

3. Which attribute is used to specify the source of an iframe?

4. How do you embed a YouTube video in an iframe?

5. Which attribute is used for security in an iframe?

HTML Entities & Symbols

HTML entities are used to display special characters that HTML normally understands as code.

Why Entities are Needed?

Some characters are reserved in HTML:

  • <
  • >
  • &

Common HTML Entities

Symbol Entity
< &lt;
> &gt;
& &amp;
© &copy;
® &reg;

Example

<p>5 &lt; 10</p>

This is the output of the code

ChatGPT Image

Emojis in HTML

<p>&#128512;</p>

This is the output of the code

ChatGPT Image

HTML Entities & Symbols Quiz

1. Why are HTML entities needed?

2. Which character is reserved in HTML?

3. Which entity is used to display the less-than sign (<)?

4. Which entity is used to display the greater-than sign (>)?

5. Which entity is used to display the ampersand (&)?

HTML Meta Tags

Meta tags give information about the webpage.

Charset

<meta charset="UTF-8">

This is the output of the code

ChatGPT Image

Viewport (Responsive Design)

<meta name="viewport" content="width=device-width, initial-scale=1.0">

This is the output of the code

ChatGPT Image

Description (SEO)

<meta name="description" content="Learn HTML from basic to advanced">

This is the output of the code

ChatGPT Image

Keywords

<meta name="keywords" content="HTML, Web Development">

This is the output of the code

ChatGPT Image

HTML Meta Tags Quiz

1. What is the purpose of meta tags?

2. Which meta tag is used to specify character encoding?

3. Which meta tag is used for responsive design?

4. Which meta tag is used for SEO description?

5. Which of the following is a correct syntax for the charset meta tag?

HTML Head Elements

Elements inside <head> are not visible on page.

Title

<title>My Website</title>

This is the output of the code

ChatGPT Image

Link (CSS)

<link rel="stylesheet" href="style.css">

This is the output of the code

ChatGPT Image

Style

<style>
  body { background: lightblue; }
</style>

This is the output of the code

ChatGPT Image

Script

<script src="script.js"></script>

This is the output of the code

ChatGPT Image

Base Tag

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

This is the output of the code

ChatGPT Image

HTML Head Elements Quiz

1. Where are head elements placed in an HTML document?

2. Which tag is used to define the title of a document?

3. Which tag is used to link an external CSS file?

4. Which tag is used to define internal CSS?

5. Which tag is used to link an external JavaScript file?

HTML Graphics

HTML supports drawings and graphics.

Canvas

Used for dynamic graphics

<canvas id="myCanvas" width="200" height="100"></canvas>
(Needs JavaScript)

This is the output of the code

ChatGPT Image

SVG

Used for vector graphics

Canvas vs SVG

Canvas SVG
Pixel-based Vector-based
JS required HTML based
Fast for games Best for icons

HTML Graphics Quiz

1. Which HTML element is used for dynamic graphics?

2. Which HTML element is used for vector graphics?

3. What is Canvas based on?

4. What is SVG based on?

5. Does Canvas require JavaScript?

HTML Accessibility

Accessibility helps disabled users.

Alt Text

<img src="img.jpg" alt="Student studying">

This is the output of the code

ChatGPT Image

Labels for Inputs

<label>Name:</label>
<input type="text">

This is the output of the code

ChatGPT Image

ARIA Attributes

<button aria-label="Close">X</button>

This is the output of the code

ChatGPT Image

Keyboard Friendly

  • Use buttons instead of div
  • Proper tab order

HTML Accessibility Quiz

1. What is the purpose of HTML accessibility?

2. Which attribute is used to provide alternative text for images?

3. Which tag is used to label input fields?

4. Which attributes are used for accessibility?

5. Which of the following is a recommended practice for keyboard accessibility?

HTML Responsive Design (Basics)

Responsive design means the website works well on mobile, tablet, and desktop.

Viewport Meta Tag

<meta name="viewport" content="width=device-width, initial-scale=1.0">

This is the output of the code

ChatGPT Image

Responsive Images

<img src="img.jpg" style="max-width:100%; height:auto;">

This is the output of the code

ChatGPT Image

Mobile-Friendly Tips

  • Use percentage width
  • Avoid fixed sizes
  • Use semantic tags

HTML Responsive Design Quiz

1. What is responsive design?

2. Which meta tag is important for responsive design?

3. Which of the following is a correct syntax for the viewport meta tag?

4. How do you make images responsive?

5. Which of the following is a mobile-friendly tip?

HTML APIs

HTML5 provides built-in APIs.

Geolocation API

Gets user location (with permission).

navigator.geolocation.getCurrentPosition();

This is the output of the code

ChatGPT Image

Drag and Drop API

draggable="true"

This is the output of the code

ChatGPT Image

Web Storage API

Local Storage

localStorage.setItem("name", "Satya");

This is the output of the code

ChatGPT Image

Session Storage

sessionStorage.setItem("id", "101");

This is the output of the code

ChatGPT Image

HTML APIs Quiz

1. What does Geolocation API do?

2. Does Geolocation API require permission?

3. Which attribute is used for the Drag and Drop API?

4. Which API is used to store data?

5. Which method is used to store data in Local Storage?

HTML SEO Basics

SEO helps websites rank on search engines.

SEO Best Practices

  • Use <h1> only once
  • Use semantic elements
  • Add meta description
  • Use alt text

SEO-Friendly Structure

<header>
<main>
<article>
<footer>

HTML SEO Basics Quiz

1. What is SEO?

2. What does SEO help with?

3. Which heading tag should be used only once?

4. Which elements are recommended for SEO?

5. Which meta tag is important for SEO?

HTML Performance

Good performance = fast website.

Best Practices

  • Compress images
  • Remove unused code
  • Minimize HTML
  • Use lazy loading

Lazy Loading

<img src="img.jpg" loading="lazy">

This is the output of the code

ChatGPT Image

HTML Performance Quiz

1. What does good performance mean?

2. Which of the following is a performance best practice?

3. Which of the following is a performance best practice?

4. Which of the following is a performance best practice?

5. Which of the following is a performance best practice?

HTML Best Practices

  • Use proper indentation
  • Close all tags
  • Use lowercase tags
  • Write clean comments
  • Use external CSS & JS

HTML Best Practices Quiz

1. Which of the following is an HTML best practice?

2. Which of the following is an HTML best practice?

3. Which of the following is an HTML best practice?

4. Which of the following is an HTML best practice?

5. Which of the following is an HTML best practice?

Deprecated HTML Tags

These tags are not recommended.

Tag Reason
<font> Use CSS
<center> Use CSS
<marquee> Outdated
<strike> Use <del>

Deprecated HTML Tags Quiz

1. Which tag is deprecated in favor of CSS?

2. Which tag is deprecated in favor of CSS?

3. Which tag is considered outdated?

4. Which tag is deprecated in favor of <del>?

5. Why is the <font> tag deprecated?

HTML with CSS

CSS styles HTML.

Inline CSS

<p style="color:red;">Text</p>

This is the output of the code

ChatGPT Image

Internal CSS

<style>
  p { color: blue; }
</style>

This is the output of the code

ChatGPT Image

External CSS (Best)

<link rel="stylesheet" href="style.css">

This is the output of the code

ChatGPT Image

HTML with CSS Quiz

1. What does CSS do?

2. Which method of adding CSS is considered best?

3. Which attribute is used for inline CSS?

4. Which tag is used to define internal CSS?

5. Which tag is used to link an external CSS file?

HTML with JavaScript

JavaScript adds functionality.

Script Tag

<script>
  alert("Hello");
</script>

This is the output of the code

ChatGPT Image

External JS

<script src="app.js"></script>

This is the output of the code

ChatGPT Image

HTML with JavaScript Quiz

1. What does JavaScript do?

2. Which tag is used to add JavaScript?

3. Which attribute is used to link an external JavaScript file?

4. Which of the following is a correct syntax for adding JavaScript?

5. Which of the following is a correct syntax for linking an external JavaScript file?

About Tagveda

1. Website Introduction

This website is created to help beginners learn HTML from scratch in a simple and practical way.

2. Purpose of the Website

Our goal is to make web development easy for students by providing clear explanations, examples, and practice exercises.

3. Who Can Use This Website

This website is designed for:

  • School students
  • Beginners in coding
  • Anyone who wants to learn HTML for free

4. What You Will Learn

Our comprehensive HTML course covers:

  1. Introduction to HTML
  2. HTML Basics
  3. HTML Elements
  4. HTML Attributes
  5. Text Formatting Tags
  6. HTML Lists
  7. HTML Links
  8. HTML Images
  9. HTML Tables
  10. HTML Forms
  11. HTML Input Types
  12. HTML Media
  13. HTML Semantic Elements
  14. HTML Layout
  15. HTML Iframes
  16. HTML Entities & Symbols
  17. HTML Meta Tags
  18. HTML Head Elements
  19. HTML Graphics
  20. HTML Accessibility
  21. HTML Responsive Design
  22. HTML APIs
  23. HTML SEO Basics
  24. HTML Performance
  25. HTML Best Practices
  26. Deprecated HTML Tags
  27. HTML with CSS
  28. HTML with JavaScript

5. Features of Your Website

Our website offers:

  • Easy language explanations
  • Practical examples
  • Mobile-friendly design
  • Free learning
  • Certificate after completion

6. Certificate Information

After completing all lessons and tests, learners will receive a certificate of completion.

7. About the Creator

Name of website founder

Saksham Satyadev Mishra

Saksham Mishra

Role / Identity

  • Student & Web Development Learner
  • Aspiring Software Engineer
  • HTML Educator

Skills or Focus Area

  • HTML & basic web development
  • Frontend learning
  • Website design

Reason for Creating the Website

I created this website to help beginners learn HTML in an easy and practical way.

Experience Level

Beginner-friendly teaching approach

Final Quiz

Test your knowledge of all HTML topics with this comprehensive quiz!

You need to score at least 80% to pass and receive your certificate.

HTML Final Quiz

Certificate of Achievement

HTML Mastery Course

This is to certify that

John Doe

has successfully completed HTML Mastery Course with distinction

demonstrating comprehensive knowledge of HTML from basics to advanced concepts

Date: January 1, 2023

Tagveda Instructor

Saksham Mishra