HTML Tutorial

Learn HTML, the language that structures every web page. Each example has a "Show Result" button so you can see what it looks like.

HTML (HyperText Markup Language) describes the structure of a web page using elements written as tags. It was created by Tim Berners-Lee in 1991. The current standard is the HTML Living Standard (commonly called HTML5).

Basic Page Structure

HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This is my first web page.</p>
</body>
</html>
PartPurpose
<!DOCTYPE html>Tells the browser this is an HTML5 document
<html>Root element
<head>Metadata: title, character set, CSS links
<body>Everything visible on the page
document<html><head><body><title><meta><h1><p>
The DOM: the browser represents the page as a tree of nodes

Anatomy of an Element

Text
<p class="intro">Hello</p>
 │   └─attribute─┘  │     └ closing tag
 └ opening tag      └ content

Some elements are void (self-closing) and have no content: <br>, <img>, <input>, <hr>, <meta>.

Track your progress through the HTML course