HTML Introduction

What is HTML?

HTML stands for HyperText Markup Language.
It is the standard language used to create web pages.
HTML helps in defining the structure and layout of a webpage using different tags.

Every website you see on the internet — from simple blogs to big platforms — is built using HTML as the base.

Why Learn HTML?

  • It is the first step in web development.

  • You can use it to create simple or complex web pages.

  • It is easy to learn and understand.

  • It works with CSS and JavaScript to create interactive websites.

Features of HTML

  • Simple and platform-independent

  • Supports text, images, videos, and hyperlinks

  • Allows embedding of CSS and JavaScript

  • Easy to learn and use

  • Supported by all modern browsers

Basic Structure of an HTML Document

Every HTML page has a fixed structure.

🌐
index.html
Copy to clipboard
<!DOCTYPE html>
<html>
  <head>
    <title>My First Web Page</title>
  </head>
  <body>
    <h1>Welcome to HTML</h1>
    <p>This is my first web page.</p>
  </body>
</html>
  • <!DOCTYPE html> — Declares the document as HTML5.

  • <html> — The root tag that wraps all content.

  • <head> — Contains information about the page (title, meta, links).

  • <title> — Displays the title on the browser tab.

  • <body> — Contains all visible elements like text, images, and links.

HTML Tags

HTML uses tags to mark up content.
A tag usually has an opening and a closing part.

Example:

🌐
index.html
Copy to clipboard
<p>This is a paragraph.</p>

Here:

  • <p> is the opening tag.

  • </p> is the closing tag.

  • The content between them is displayed in the browser.

Commonly Used HTML Tags

TagDescriptionExample
<h1><h6>Headings (largest to smallest)<h1>Main Title</h1>
<p>Paragraph<p>This is a paragraph.</p>
<a>Link<a href="https://example.com">Visit Site</a>
<img>Image<img src="photo.jpg" alt="Example">
<br>Line breakLine1<br>Line2
<hr>Horizontal line<hr>
<div>Container or section<div>Content here</div>

HTML Attributes

Attributes give extra details to an element.
They are written inside the opening tag.

Example:

🌐
index.html
Copy to clipboard
<a href="https://www.google.com" target="_blank">Visit Google</a>

Here:

  • href — Specifies the link address.

  • target="_blank" — Opens the link in a new tab.

Summary

  • HTML is the base of all websites.

  • It uses tags and attributes to describe content.

  • Every HTML page starts with <!DOCTYPE html>.

  • It works together with CSS (for design) and JavaScript (for interactivity).