Make it yours
In index.html, replace the heading and describe something you love.
HTML gives your page meaning. Try changing the heading between <h1> and </h1>.
Your preview runs here. Your files stay in this browser until you download them.
Change a line. See it happen. Build with the three real files that power a website, then take them with you.
In index.html, replace the heading and describe something you love.
In style.css, change the background colour and the heading size.
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.
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.
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.
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.
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….
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
With the folder open, use the "New File" button at the top of the sidebar three times and create exactly these names:
index.html — the content and structure. This is the only file the browser asks for by itself.style.css — the design: colour, spacing, size, layout.script.js — the behaviour: things that happen after the page is on screen.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.
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:
| Line | Job |
|---|---|
<!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. |
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
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.
There are two ways to open your page:
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.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.
Professional developers don't flip back and forth between tabs. They view related files simultaneously:
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.<!-- --> for HTML, /* */ for CSS, // for JavaScript)."It looks fine" is not evidence. Check both connections deliberately:
style.css. If it is still plain white, the stylesheet did not load.script.js is running. If the console is blank, the script was not executed.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.
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 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.
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.