HTML, explained simply Start learning

A tiny beginner's guide

HTML is how a web page gets its shape.

It gives content structure and meaning: this is a heading, that is a paragraph, and this is a link. Start with a few tags and build from there.

About 5 minutes No setup needed to learn
01

The basic idea

HTML is made of elements. Most elements have an opening tag, some content, and a closing tag. The tag name tells the browser what that content is.

One HTML element
<p>Hello, web!</p>

What the browser shows

Hello, web!

The <p> tags mark a paragraph. The first opens it; </p> closes it. The browser displays the content between them.

02

A complete page

Every HTML document follows a familiar outer structure. You can use this as the starting point for a new page.

index.html
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>My first page</title>
	</head>
	<body>
		<h1>Hello, world!</h1>
		<p>I made a web page.</p>
	</body>
</html>

<head>

Page information, like its title and character set. It isn't the visible page content.

<body>

The content people see and interact with in the browser window.

Save the file with a .html ending, then open it in a browser to see your page.
03

Useful elements

Choose a tag that describes what the content does. A few common ones go a long way:

<h1> – <h6>

Headings, from the main title down to smaller section titles.

<p>

A paragraph of text.

<a>

A link to another page or place. Add an href to set its destination.

<img>

An image. Add src for its location and alt to describe it.

<ul> and <li>

A bulleted list and each item inside it.

<button>

An action a person can trigger, such as submitting a form.

04

Adding details

Attributes add information to an element. They go inside the opening tag, usually as a name and a value.

A link with a destination
<a href="https://example.com">Visit the site</a>

Here, href is the attribute and the web address is its value. Different elements have different useful attributes.

05

Your first page

Try it: make a tiny HTML page of your own.

STEP 01

Open an editor

Use any plain-text editor or code editor you have.

STEP 02

Add some tags

Write a heading, a paragraph, and maybe a link.

STEP 03

Open your file

Save it as index.html, then open it in your browser.