HTML Basics

What you'll learn: Learn the fundamentals of HTML and how to structure web content

Introduction to HTML

HTML (HyperText Markup Language) is the standard markup language for creating web pages. It describes the structure of web content using elements and tags.

Basic Structure

Every HTML document follows this basic structure:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This is my first web page.</p>
</body>
</html>

Common HTML Elements

Headings

HTML provides six levels of headings, from <h1> to <h6>:

<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Sub-subheading</h3>

Paragraphs

Use the <p> tag for paragraphs:

<p>This is a paragraph of text.</p>

Create hyperlinks with the <a> tag:

<a href="https://example.com">Visit Example</a>

Images

Display images using the <img> tag:

<img src="image.jpg" alt="Description of image">

Practice Exercise

Create a simple HTML page with:

  1. A main heading
  2. Two paragraphs
  3. A link to your favorite website
  4. An image

Next Steps

Once you’re comfortable with basic HTML, move on to learning about HTML forms, semantic elements, and accessibility best practices.