Chapter 010m

HTML Introduction

Learn what HTML is, how HTML Elements work, and how to create your first HTML document with simple examples and practice exercises.

Welcome to the first chapter of the W3PrimeCode HTML Tutorial!

HTML is the foundation of Web Development. Whether you want to create a personal website, build a blog, or become a Frontend Developer, understanding HTML is an essential first step.

In this chapter, you will learn what HTML is, how it works, and how a basic HTML Document is structured.

What is HTML?

HTML stands for HyperText Markup Language.

HTML is the standard Markup Language used to create and structure Web Pages.

  • HTML describes the structure and meaning of web content.
  • HTML uses Elements and Tags to organize content.
  • HTML tells the Browser how content is organized.
  • HTML Documents are interpreted by Web Browsers.
  • HTML works alongside CSS and JavaScript to create modern websites.

HTML is not a Programming Language. It is a Markup Language because it uses Tags to describe content rather than providing general-purpose programming logic.

What is an HTML Element?

An HTML Element represents a part of a Web Page, such as a Heading, Paragraph, or Link.

Most HTML Elements consist of a Start Tag, Content, and an End Tag.

Basic Syntax:

html
<tagname>Content goes here</tagname>

Example:

html
<h1>My First Heading</h1>
<p>My First Paragraph.</p>

Explanation:

  • <h1> is the Start Tag of a Heading Element.
  • My First Heading is its Content.
  • </h1> is the End Tag.
  • <p> defines a Paragraph.
  • </p> closes the Paragraph Element.

Note: Not every HTML Element requires an End Tag. You will learn about Void Elements in later chapters.

Your First HTML Document

Let's create a simple HTML Page.

Example:

html
<!DOCTYPE html>
<html>
<head>
    <title>My First HTML Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to W3PrimeCode.</p>
</body>
</html>

Example Explained

CodeExplanation
\<!DOCTYPE html>Declares that the Document uses HTML5.
\<html>Represents the Root Element of the HTML Document.
\<head>Contains document Metadata.
\<title>Specifies the title displayed in the Browser Tab.
\<body>Contains the visible page content.
\<h1>Defines a top-level Heading.
\<p>Defines a Paragraph.

The Browser reads the HTML Document, interprets its Elements, and renders the page.

How Does HTML Work?

When you open a Web Page, the following process generally takes place:

  1. The Browser receives an HTML Document.
  2. It parses the HTML and constructs a Document Object Model (DOM).
  3. It uses the document structure, along with applicable styling and other resources, to render the Web Page.
  4. The resulting content appears on your screen.

For example:

html
<h1>Learn HTML</h1>
<p>HTML is easy to start learning.</p>

HTML, CSS, and JavaScript

These three technologies have different responsibilities.

TechnologyPurpose
HTMLDefines the structure and meaning of content.
CSSControls appearance and layout.
JavaScriptAdds interactivity and dynamic behavior.

For example, HTML creates a Button, CSS can change its appearance, and JavaScript can define what happens when someone clicks it.

Important Points to Remember

  • HTML stands for HyperText Markup Language.
  • HTML is a Markup Language, not a general-purpose Programming Language.
  • HTML Documents commonly use the .html extension.
  • The <body> Element contains visible page content.
  • The <head> Element contains document Metadata.
  • Browsers interpret HTML to display Web Pages.
  • HTML Tags are generally case-insensitive, but lowercase is recommended for consistency.
  • HTML defines structure; CSS and JavaScript serve different purposes.

Common Beginner Mistakes

Mistake 1: Forgetting an End Tag

Incorrect:

html
<h1>Welcome
<p>Learn HTML</p>

Correct:

html
<h1>Welcome</h1>
<p>Learn HTML</p>

Mistake 2: Placing Visible Content Inside<head>

Incorrect:

html
<head>
    <h1>Welcome</h1>
</head>

Correct:

html
<head>
    <title>My Website</title>
</head>
<body>
    <h1>Welcome</h1>
</body>

Mistake 3: Saving a File with the Wrong Extension

Save your HTML Document as index.html, not index.txt.

Practical Use Case

Imagine you want to create a personal introduction page.

html
<!DOCTYPE html>
<html>
<head>
    <title>About Me</title>
</head>
<body>
    <h1>My Name is Alex</h1>
    <p>I am learning Web Development.</p>
    <p>This is my first HTML project.</p>
</body>
</html>

This example demonstrates how HTML can organize information on a simple personal Web Page.

Try It Yourself

Modify the following code to display your own name and a short introduction.

html
<!DOCTYPE html>
<html>
<head>
    <title>My Introduction</title>
</head>
<body>
    <h1>Your Name</h1>
    <p>Write something about yourself.</p>
</body>
</html>

Your Task:

  1. Replace Your Name with your name.
  2. Write a sentence about yourself.
  3. Change the Browser Tab title.
  4. Run the code and observe the result.

Practice Exercises

Exercise 1 — Easy: What does HTML stand for?

Exercise 2 — Easy: Which HTML Element contains the visible content of a Web Page?

Exercise 3 — Medium: Write an HTML Heading containing the text Welcome to HTML.

Exercise 4 — Medium: Create a Paragraph containing I am learning HTML.

Exercise 5 — Challenge: Create a complete HTML Document containing a Title, Heading, and two Paragraphs.