Build Your Own Web
my-site / Ready to create
Tab indents · Esc then Tab exits

HTML gives your page meaning. Try changing the heading between <h1> and </h1>.

Live preview
Console · messages from your JavaScript

Your preview runs here. Your files stay in this browser until you download them.

WEB DESIGN / STUDIO 01

Your first site.
Your own little corner of the web.

Change a line. See it happen. Build with the three real files that power a website, then take them with you.

Follow the lesson ↓
01 / STRUCTURE

Make it yours

In index.html, replace the heading and describe something you love.

02 / STYLE

Set the mood

In style.css, change the background colour and the heading size.

03 / BEHAVIOR

Make it respond

Click the button in your preview. Then change its message in script.js.

Want drawing tools and blocks too? Open the full Web Studio. Download your files here, then use “Open my own files” in its Code tab to continue.

THE LESSON / 45–60 MINUTES

Set up your first site

You’ve seen the files working together. Now make a folder on your computer, open it in VS Code, and learn how the browser finds each file.

Step 1 — Install and open Visual Studio Code

Visual Studio Code (VS Code) is a free text editor used by millions of professional software engineers and web developers worldwide. It does not run or build your site itself — it writes plain text files that the web browser renders into living interactive experiences. We use VS Code because its visual file tree, syntax highlighting, and live development tools keep you organized and prevent missing-file errors.

  1. Download VS Code from code.visualstudio.com and install it. On a school device, check if it is pre-installed in your applications menu.
  2. Open VS Code. Close the welcome tab. Look at the left vertical bar: that is the Activity Bar.
  3. Install the Live Server extension now: click the Extensions icon (Ctrl+Shift+X / Cmd+Shift+X), search for Live Server by Ritwick Dey, and click Install. This gives you instant live-reloading in the browser every time you save.
  4. Make a folder for your site in your computer's documents or student drive first, before creating files. Call it my-site. Use lowercase with no spaces — web addresses hate spaces!

For an in-depth reference of keyboard shortcuts and customization, bookmark the Mastering VS Code Guide.

Step 2 — Open a folder, not a file

This is the step people skip, and it costs them an hour later. In VS Code choose File → Open Folder… (or press Ctrl+K Ctrl+O / Cmd+O) and select your my-site folder. Do not use Open File.

A website is never one file. It is a family of files that refer to each other by name. With the folder open, the sidebar Explorer shows every file inside it, new files land in the right place, and the file paths you write match what is really on disk. If you open a single file instead, you are editing something with no visible neighbours — which is why stylesheets mysteriously fail to load.

Check: Look at the top of the Explorer sidebar on the left. It should say MY-SITE in capital letters. If it says OPEN EDITORS with one lonely file and no folder header, close it and use File → Open Folder….

Turn of the century oak four-drawer vertical filing cabinet with labeled brass card pulls
Edwin G. Seibels' Vertical Filing System (1898) The origin of modern file directories. Before Seibels patented vertical filing folders with tabs in 1898, documents were kept in horizontal cubbyholes. Operating system folders and relative web paths (index.html, images/photo.jpg, ../style.css) directly inherit this physical hierarchy of nested tabbed folders. Credit: Library of Congress / Wikimedia Commons · Public domain · source
Row of labeled wooden library card catalog drawers holding alphabetically organized cards
The File Hierarchy: Working Within a Root Directory Opening a workspace root folder in VS Code acts like stepping up to a master card catalog cabinet. Because relative paths are calculated from the root folder, keeping all stylesheets, images, and HTML files organized within one root prevents missing asset links (404 errors) when published online. Credit: Wikimedia Commons · Public domain · source

Step 3 — Create the three files

With the folder open, use the "New File" button at the top of the sidebar three times and create exactly these names:

The part after the dot is the file extension, and it is not decoration. It tells the browser how to interpret the bytes inside. A stylesheet saved as style.txt is a text file that happens to contain CSS, and the browser will refuse to apply it. VS Code gives you a clue: an .html file gets colour highlighting and tag completion. If your file looks grey and plain, check the extension.

Windows and macOS often hide extensions in the file manager, and they usually treat Index.HTML and index.html as the same file. Most web servers — including GitHub Pages, where this course publishes — do not. Filename case matters. A link to Style.css that works perfectly on your laptop can return a 404 the moment the site is online, and that is a genuinely miserable bug to chase. Type every filename in lowercase, every time, and type the link the same way.

Step 4 — The smallest real index.html (and the Emmet shortcut)

There are two ways to get your document skeleton. You can type it line by line, or you can use VS Code's built-in Emmet superpower:

The 1-Second Skeleton: Click into an empty index.html, type an exclamation point !, and press Tab or Enter. VS Code will instantly expand it into a complete, standard HTML5 boilerplate!

Here is the exact code you need in index.html. Type or inspect it carefully: having the shape of a document in your head is fundamental to web development.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My site</title>
  <link rel="stylesheet" href="style.css">
  <script src="script.js" defer></script>
</head>
<body>
  <h1>My site</h1>
  <p>This page is running from my own computer.</p>
</body>
</html>

Every line is doing a job:

What each line of the skeleton is for
LineJob
<!doctype html>Switches the browser into modern standards mode. Leave it out and it falls back to old, inconsistent behaviour.
<html lang="en">Declares the page's language, so screen readers pick the right pronunciation.
<head>Information about the page. Nothing in here is drawn on screen.
<meta charset="utf-8">Says the text is UTF-8, so accents and every other alphabet survive. Without it you get characters like ’.
<meta name="viewport"…>Tells phones to use the real device width instead of shrinking a desktop layout.
<title>The tab name, the bookmark name, and the first thing a search result shows.
<body>Everything a visitor actually sees.
Tim Berners-Lee's NeXTcube computer used as the first web server at CERN, with a handwritten warning label DO NOT POWER IT DOWN
The World's First Web Server (CERN, 1990) Tim Berners-Lee's NeXTcube workstation at the CERN physics laboratory in Switzerland. Berners-Lee used this machine to invent the World Wide Web, creating the first HTTP daemon (httpd), the first web client/editor (WorldWideWeb), and hosting the world's very first website (http://info.cern.ch) in December 1990. The handwritten label on the front case reads: “This machine is a server. DO NOT POWER IT DOWN!!” Credit: CERN / Wikimedia Commons · CC BY-SA 3.0 · source
Portrait of Sir Tim Berners-Lee, inventor of the World Wide Web, HTML, and HTTP
Sir Tim Berners-Lee (Inventor of the Web) British computer scientist Tim Berners-Lee proposed the World Wide Web in 1989 as a decentralized system for sharing information across different operating systems. He designed HTML to give documents hierarchical meaning, HTTP to request them over a network, and URIs (URLs) as universal addresses. In 1993, CERN released the web protocols into the public domain royalty-free, ensuring the open web could grow without corporate paywalls. Credit: Paul Clarke / Wikimedia Commons · CC BY-SA 4.0 · source

Step 5 — Connect the other two files

Your three files do not know about each other until the HTML says so. Two lines do all the connecting:

<link rel="stylesheet" href="style.css">
<script src="script.js" defer></script>

<link> has no closing tag and no visible content. The rel="stylesheet" part is the browser's instruction for what to do with the file it fetches; without it the file is downloaded and ignored. href is the address.

<script> always needs a closing </script>, even when it is empty. The defer attribute means "download this now, but do not run it until the HTML is finished." That matters because JavaScript usually wants to find elements on the page, and it cannot find what the browser has not read yet. Leave defer off, put the script in the head, and your code will look for an <h1> that does not exist yet and quietly get null.

Now put something obvious in each file so you can prove the connection worked.

/* style.css */
body {
  background: #10233c;
  color: #f4f7fb;
  font-family: system-ui, sans-serif;
  padding: 2rem;
}
// script.js
console.log("script.js is running");

Pick a background colour you would never choose on purpose. This first style is evidence, not taste: a subtle change proves nothing, because you cannot tell it from the default.

Step 6 — Open with Live Server (the real development loop)

There are two ways to open your page:

  1. Use VS Code Live Server (Recommended): Look at the blue Status Bar at the bottom right corner of VS Code and click "Go Live" (or right-click index.html in the Explorer sidebar and select "Open with Live Server"). Your browser will immediately open to http://127.0.0.1:5500/index.html. Keep this browser window open side-by-side with VS Code! Whenever you save a change in VS Code, the browser automatically refreshes in real time.
  2. Double-click index.html in your file manager: The address bar starts with file:/// — the browser is reading files directly from your hard drive. Double-clicking works for basic HTML/CSS, but under file:/// there is no HTTP server. Anything requiring a network request (such as JavaScript fetch() or ES modules) is strictly blocked by browser security. Using Live Server rehearses how real web hosting works on GitHub Pages.

Repair: Did the browser open your HTML as raw code with visible tags instead of drawing the web page? That means the file was saved with an accidental text extension like index.html.txt. Rename the file in the VS Code sidebar to strictly index.html.

The Gutenberg Bible Lenox Copy displayed open at the New York Public Library showing illuminated columns of text
The Gutenberg Bible (Lenox Copy, c. 1455) The milestone of standardized publishing. Johannes Gutenberg's movable metal type proved that standardized glyph components could be assembled into reproducible pages for mass dissemination. HTML5 boilerplate serves the identical function for the digital age: an open, standardized document foundation readable by any browser worldwide. Credit: New York Public Library / Wikimedia Commons · Public domain · source
Typesetter galley proof sheet showing marginal proofreader corrections and proof marks
The Galley Proof: The Traditional “Live Preview” Loop Long before computer monitors, printers pulled a single inked proof sheet from a galley press to inspect spelling, leading, and alignment before running the full press. VS Code Live Server provides the modern real-time equivalent: an instant local preview loop where every code save immediately renders in the browser. Credit: Wikimedia Commons · Public domain · source

Step 7 — Split your editor and master three essential shortcuts

Professional developers don't flip back and forth between tabs. They view related files simultaneously:

  1. Split Editor Side-by-Side: With index.html open, press Ctrl+\ (Mac: Cmd+\) or drag the style.css tab to the right half of the editor window. Now you have HTML on the left and CSS on the right. When you write a class name in HTML, you can write its matching rule in CSS without losing your place.
  2. Format Document: If your indentation gets messy, press Shift+Alt+F (Mac: Shift+Option+F). VS Code will instantly line up all your tags, properties, and brackets cleanly.
  3. Toggle Comment: Place your cursor on any line and press Ctrl+/ (Mac: Cmd+/). VS Code comments out the line in the correct language syntax (<!-- --> for HTML, /* */ for CSS, // for JavaScript).

Step 8 — Prove the CSS and JavaScript really loaded

"It looks fine" is not evidence. Check both connections deliberately:

  1. CSS: The page background is the unmistakable colour you chose in style.css. If it is still plain white, the stylesheet did not load.
  2. JavaScript: Open the browser developer tools (F12, or Ctrl+Shift+I, or Cmd+Option+I on a Mac) and click the Console tab. You should see script.js is running. If the console is blank, the script was not executed.
  3. Network Tab Verification: In developer tools, click the Network tab and refresh the page (Ctrl+R / Cmd+R). You should see exactly three rows — index.html, style.css, and script.js — each with a 200 OK status code. A red row or a 404 Not Found error tells you the browser looked for that exact filename and the server could not find it.

That screen is the entire mental model of the web: the browser fetched one initial HTML document, read it line by line, encountered two linked references in <head>, and made two additional network requests. When a file goes missing, the issue is almost always a spelling typo, mismatched uppercase/lowercase letters, or an incorrect relative folder path.

Lab — Trace the route

A path in href or src is directions, not a location. A relative path starts from the folder holding the HTML file you are writing in. ../ means "go up one folder to the parent"; a name with no slash and no dots means "a file sitting right here beside me."

Here is the folder your site is growing into. Trace each answer with your finger before you type it.

my-site/
├── index.html
├── style.css
├── script.js
├── images/
│   └── logo.svg
└── pages/
    └── about.html

Write the path

Pick a question, type the path exactly as you would type it in the HTML, and check it. Answers are lowercase, with forward slashes.

Trace from the current HTML file’s folder. Then check your route.

Check: a correct answer names the destination and nothing more. From index.html, the stylesheet is simply style.css — you are already in the right folder, so there is nothing to travel. Reaching into a folder adds the folder name and a slash: images/logo.svg.

Repair: from pages/about.html you are one folder deep, so every route out starts with ../ to climb back to my-site/. From there you carry on as if you were index.html: ../index.html, or ../images/logo.svg. A leading slash, /images/logo.svg, means something else — "start at the very top of the site" — and it breaks under file:///. Avoid it for now.

Finish and save your evidence

Before you close the editor, screenshot your page beside the console showing script.js is running, and save it in your project folder. That is your proof the three files were connected, and you will want it when something breaks later and you need to know what "working" looked like.

Next lesson replaces the placeholder paragraph with real structure: headings, landmarks, links, images and lists that carry meaning.