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.
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.
<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.
A complete page
Every HTML document follows a familiar outer structure. You can use this as the starting point for a new page.
<!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.
.html ending, then open it in a browser to see your page.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.
Adding details
Attributes add information to an element. They go inside the opening tag, usually as a name and a value.
<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.
Your first page
Try it: make a tiny HTML page of your own.
Open an editor
Use any plain-text editor or code editor you have.
Add some tags
Write a heading, a paragraph, and maybe a link.
Open your file
Save it as index.html, then open it in your browser.