← Prep

Lesson 3 of 4 ⏱ 10 minutes

Your first file and folder for the web

We'll set up the folder where your website will live, and check that everything works.

A website lives in a folder

Every website in the world is really just a pile of files in a folder. Let’s set up yours.

  1. Create a folder called my-website. On your desktop, right-click → New Folder (on Mac it’s also New Folder, on Windows it’s New → Folder) and name it my-website.

  2. Open the folder in VS Code. Launch VS Code and from the menu choose File → Open Folder… and find your my-website folder. If VS Code asks whether you trust the authors of this folder, click Yes, I trust the authors: you’re the author, after all!

  3. Create a file called index.html. On the left panel, hover over the folder name and click the New File icon (a page with a plus sign). Type exactly: index.html and press Enter.

💡

Why index.html specifically? It’s the agreed-upon name for a website’s main page. When a browser arrives in a folder, it looks first for a file called index.html, just like walking into school and heading straight to your own classroom.

Write your first code

In the index.html file, type this (or copy it using the button in the top right):

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My website</title>
  </head>
  <body>
    <h1>It works!</h1>
    <p>This is my very first file. From here I'll build a whole website.</p>
  </body>
</html>

Save the file: Ctrl+S (on Mac, Cmd+S). Save often: an unsaved file has a little dot next to its name in VS Code.

Open your page in the browser

Find the index.html file in your folder (on the desktop → my-website) and double-click to open it. A browser will open showing your page with the words “It works!”.

✅

Check yourself: You see a big heading that says “It works!” in the browser. If so, you now have a working web workshop, and you can head straight into Level 1!

💡

A handy trick: keep VS Code and your browser open side by side. Whenever you change something in the code, save it (Ctrl+S) and press F5 in the browser to refresh. Your change shows up right away.

What to take away from this chapter