Lesson 4 of 36
HTML Tutorial

Your First Page

Set up an editor and a browser, then write, save and open your first real HTML page.

3 min readBeginnerWeb FundamentalsIntroduction

Time to stop reading and start building. You only need two free tools: a code editor and a web browser. By the end of this lesson you will have a working Brew and Byte home page on your own computer.

Choose your tools#

A code editor. Any plain-text editor works, but a code editor makes life easier with colours, auto-closing tags and a built-in file explorer. Visual Studio Code is a popular free choice. Avoid word processors such as Word: they save formatting data, not plain text.

A browser. Use any modern browser, such as Chrome, Firefox, Edge or Safari. Developers usually test in more than one. Learn the shortcut for Developer Tools (often F12 or Ctrl+Shift+I) because it lets you inspect the structure of any page.

Create the project folder#

  1. Make a folder called brew-and-byte.
  2. Open that folder in your editor.
  3. Create a new file called index.html.

The name index.html is special: web servers show it by default when someone visits a folder, so it is the standard name for a home page. Use lowercase letters and hyphens in file names, with no spaces. Spaces and capitals cause confusing broken links later.

Write the page#

Type the following into index.html. Typing it, rather than pasting, builds muscle memory.

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Brew and Byte</title>
  </head>
  <body>
    <h1>Brew and Byte</h1>
    <p>Coffee, cake and quiet desks in the heart of the city.</p>
    <p>Come by between 7am and 7pm, every day.</p>
  </body>
</html>

Open it in the browser#

Save the file, then either double-click it in your file manager or drag it onto a browser window. The address bar will show a path starting with file://, meaning the page is loaded from your disk rather than from the internet. You should see a large heading and two paragraphs, and the tab should read "Brew and Byte".

The edit and refresh loop#

From now on, your workflow is a loop:

  1. Edit the HTML in the editor.
  2. Save the file.
  3. Refresh the browser.
  4. Check the result, and use Developer Tools if something looks wrong.

Try adding a third paragraph, save, and refresh. Try making a deliberate typo in a tag name and observe what the browser does. Learning to read the result of a mistake is a core skill.

Common mistakes#

  • Saving the file as index.html.txt because the operating system hides extensions. Turn on "show file extensions" to check.
  • Editing the file but forgetting to save, then wondering why nothing changed.
  • Opening a stale copy from a different folder.
  • Using spaces or capital letters in file names.
  • Forgetting the .html extension, so the file opens as plain text.

Try it yourself#

Replace the cafe with a topic of your own, such as a personal portfolio. Change the title, heading and paragraphs. Add a second heading with <h2> called "About me" and a paragraph beneath it. Open the browser's Developer Tools, find the <body> element in the Elements panel, and expand and collapse its children to see the tree the browser built.

Recap#

You need a code editor and a browser. Save your page as index.html in a project folder, open it in the browser, and refine it using the edit, save, refresh loop. Clean file names and a correct skeleton prevent most beginner headaches.

Check your understanding

Lesson quiz

Optional

A short quiz to check what you just learned.

Questions
3
Time limit
5 min
Pass mark
70%
Best score
-