How to Build Your First HTML Website (Step by Step)

Write a simple web page with a heading, text, a picture and a link, and see it appear live in the playground.

Tryyourselfs Team· · 2 min read Tutorial

Every website, however large, is built from HTML. It is easier than it looks: you write a few lines, and the browser turns them into a page. In this tutorial you will make a small page and see it live. Open the code playground in another tab and type the examples as you go.

1. The skeleton of a page

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My first page</title>
</head>
<body>
  <h1>Hello, world!</h1>
</body>
</html>
  • The <head> holds information about the page, such as its title.
  • The <body> holds what people see.

2. Headings and paragraphs

Use <h1> for the main heading and <h2> for sections. Write text in paragraphs:

<h1>About me</h1>
<p>I am learning to build websites.</p>
<a href="https://example.com">Visit a website</a>
<img src="photo.jpg" alt="A short description of the picture">

Always add the alt text: it describes the picture for people who cannot see it.

4. Lists

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

5. Add some style with CSS

CSS controls how the page looks. Put it in the head:

<style>
  body { font-family: sans-serif; max-width: 40rem; margin: 2rem auto; }
  h1 { color: #c00000; }
</style>

Pick colours with the Color Picker, and tidy your code with the HTML Formatter and CSS Formatter.

6. Check your work

Change something small and look at the result. If something does not appear, check for a missing closing tag such as </p>.

7. Go further

  • Build a complete page with a guided project: each step is checked for you, with hints and a live preview.
  • Start from a template and change it to make it yours.
  • Practise JavaScript with the coding challenges.

Tips for beginners

  • Type the code yourself instead of copying it. You learn faster.
  • Change one thing at a time.
  • Keep your files organised, and always keep a copy of your work.

HtmlCssbeginnerswebsite

Was this article helpful?

Put it into practice

Try it yourself