Getting Started with HTML

A beginner's introduction to HTML, covering what it is, its basic structure, and practical uses.

🎯 Introduction

By the end of this introduction, you will have the foundation you need to start building web pages. HTML provides a page's structure. Once you understand it, you can:

  • Build your own personal website
  • Write blog posts and publish them online
  • Understand how web pages are structured
  • Prepare to learn CSS and JavaScript
  • Read and edit page source code to take more control over your content

If you want to display information on the web, publish content, or get started with frontend development, HTML is the place to begin.


💡 What Is HTML?

HTML stands for HyperText Markup Language. It is a language for structuring web content. It is a markup language rather than a programming language: it tells the browser what content a page contains and how that content is organized.

What HTML Does

PurposeDescription
Present contentDisplay text, images, links, videos, tables, and other page elements
Structure pagesOrganize pages into headings, paragraphs, lists, navigation, footers, and more
Convey meaningIdentify content as a heading, list, and so on, helping search engines and assistive technologies understand it
Work with CSS/JSUse CSS for styling and JavaScript for interactivity

📘 What Do Hypertext and Markup Language Mean?

Hypertext

Plain text is typically read from beginning to end. Hypertext supports nonlinear reading: a hyperlink lets you select text to jump to another page, section, file, or website. It can also include nontext content such as images, videos, charts, and tables.

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

Markup Language

Markup uses special notation to describe and structure content. For example:

<h1>This is a level-one heading</h1>
<p>This is a paragraph.</p>

HTML uses tags enclosed in angle brackets, such as <p>, to tell the browser what text means and how to present it.


🧱 Understanding an HTML Page's Structure

A typical HTML page contains the following parts:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>My First Web Page</title>
    </head>
    <body>
        <h1>Welcome to My Web Page</h1>
        <p>This is the page content.</p>
    </body>
</html>

Page Structure Reference

TagPurpose
<!DOCTYPE>Declares the document type so the browser parses the page as HTML5
<html>The root element containing all HTML content
<head>Contains page metadata that is not displayed as page content
<meta>Specifies metadata such as the character encoding (UTF-8 is recommended)
<title>Sets the page title displayed in the browser tab
<body>Contains the content displayed on the page

Common Content Tags

TagPurposeExample
<h1>~<h6>Heading levels, with h1 the highest<h1>Main Heading</h1>
<p>A paragraph<p>A paragraph.</p>
<a>A hyperlink<a href="#">Link</a>
<img>An image<img src="logo.png" alt="logo">
<ul>An unordered list<ul><li>Item 1</li></ul>
<ol>An ordered list<ol><li>First</li></ol>
<div>A generic block container<div>Block</div>
<span>A generic inline container<span>Content</span>

❓ Questions and Answers

Q1: Is HTML a programming language?

No. It is a markup language whose main purpose is to structure web content.

Q2: Why does HTML need semantics?

Semantic tags help search engines understand pages and help screen readers present content to people with disabilities.

Q3: Does every page need a <head> tag?

The tag is not always required, but including it is recommended. This element holds the title, character encoding, CSS links, and other metadata.


🧪 Exercises

Exercise 1: Create a Simple Web Page

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>Practice Page</title>
    </head>
    <body>
        <h1>Hello, World!</h1>
        <p>This is my first HTML page.</p>
        <a href="https://www.example.com">Visit the website</a>
    </body>
</html>

Copy this code into your editor and preview the page!

Exercise 2: Add an Image and a List

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>Images and Lists</title>
    </head>
    <body>
        <h2>My Favorite Fruits</h2>
        <ul>
            <li>🍎 Apples</li>
            <li>🍌 Bananas</li>
            <li>🍇 Grapes</li>
        </ul>
        <img src="https://via.placeholder.com/150" alt="Example image" />
    </body>
</html>

Copy this code into your editor and preview the page!


🎉 You now understand HTML's basic concepts, semantic tags, page structure, and content organization! Next, explore CSS and JavaScript to style your pages and add interactivity!