The first web page that you write is one file of text, and you can open it in a browser without installing anything.
The moment that you add a stylesheet, an image, and a second page, though, you also need to understand paths and a local server. The difference between those two is where most beginner confusion comes from.
The previous lesson in this module covered "What Are the Parts of a Complete HTML Page?", and the next lesson in this module is about "How Do Browser DevTools Expose Any Page's HTML and CSS?".
How do I write and open the first page?
You create a file called index.html in an empty folder, you put this in it, and you double-click it.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My first page</title>
</head>
<body>
<h1>It works</h1>
<p>You are reading a file that lives on your own machine.</p>
<p><a href="about.html">About this page</a></p>
</body>
</html>The address bar will show a file:// URL. That is the browser reading a file straight off your disk, with no server involved.
It works perfectly for that one file, and it is how every beginner starts.
How do the folders and the paths work?
Real sites are made of folders of files, and a link is a path from the current page to another file. There are two forms that cover most of the cases.
about.html same folder as the current page
pages/about.html a subfolder called "pages"
../styles/site.css up one folder, then into "styles"
https://example.com/x a different site entirely (absolute URL)The paths are relative to the folder of the page, and not to the root of your project. That is why a link that works on one page breaks on another.
The ../ form walks up one level, and it is the one to watch. You move the page deeper into a folder, and the link needs another ../.
site/
index.html
about.html
pages/
contact.html <-- a link to the logo here needs ../../images/logo.png
images/
logo.png
styles/
site.cssWhy should I use a local server?
Because the file:// is not how the web works. Real pages are served over HTTP, and a few important behaviours only appear when you serve them.
The modules and the fetch are blocked on a file:// for security reasons. The browser treats every file as a separate opaque origin. And the paths behave differently.
Every real deployment serves the files, so every real project should be developed in the same way.
# from your project folder, start a tiny static server
python -m http.server 8000
# then open
# http://localhost:8000/Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [10/Oct/2026:12:00:00] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [10/Oct/2026:12:00:01] "GET /styles/site.css HTTP/1.1" 200 -Every request is logged, and that is a gift when you are learning. You can see exactly which files the browser asked for, and a request that returns a 404 points straight at the path that you got wrong.
The address is localhost because the server is running on your own machine, and nothing is exposed to your network.
How should a small project be organised?
You keep the HTML at the top level, and you put the assets in clearly named folders. A structure that stays out of the way looks like this.
my-site/
index.html
about.html
css/
style.css
js/
main.js
images/
logo.svgTwo rules keep it maintainable.
You keep the stylesheet separate from the markup, so that a change to the design does not mean editing every page.
And you use short, lower-case file names with hyphens, because spaces and capital letters cause trouble in the URLs and on the case-sensitive servers.
Why is the first page called index.html?
Because when a request comes in for a directory with no filename, the server looks for a file called index.html inside it.
That is the convention on every web server in common use, and it is the reason that the https://example.com/ and the https://example.com/index.html show the same page.
request: GET /articles/
server: looks for /articles/index.html
finds it, sends it, URL stays /articles/Naming your entry page index.html is not a requirement, but it is the convention that makes the shortest possible URLs work. If you name it home.html instead, then the root URL needs a redirect, and every absolute link that you write has to include the filename.
How do you edit and see the changes safely?
You save the file, you switch to the browser, and you reload.
Two habits make that loop painless.
You edit the file in an editor that shows the file extension, so that the index.html.txt never happens. That suffix makes the file a text file, and the browser will happily display its contents instead of rendering them.
And you keep the browser tab beside the editor rather than minimising it, because the round trip is what you are trying to make fast.
the loop you want
edit -> save -> reload -> look
what breaks it
a cached stylesheet that did not update
a typo in the file path
a stray smart quote in an attribute
a missing closing tag further up the fileIf a change does not appear, the first thing to check is the console. A CSS parse error is reported there, and it names the file and the line.
The second thing to check is the network tab, where a request that returns a 404 tells you that the browser asked for a file that is not where you think it is.
Those two panels resolve almost every "my change did nothing" moment in under a minute.
What should you build next?
You add a second page and you link to it, and then you add an image and a stylesheet, and you get the folder structure right before the file count grows.
Two small pages that link to each other, that share a stylesheet, and that open correctly from a local server, are a complete miniature of how a real site works. And it is small enough to hold in your head while you learn the rest of the tools.
Quick reference
- One file, double-clicked, works, and the URL starts with
file://. - The relative paths are resolved from the folder of the page itself, so the depth changes them.
- You serve the projects over the HTTP with a local server, because the modules and the fetch need it.
- The server log shows which of the files were requested and which ones 404'd.
- You keep the HTML at the top level, the assets in the named folders, and the names lower-case and hyphenated.
Try it yourself: you build a two-page site with a shared stylesheet and an image, you open it by double-clicking, and then you start a local server and you compare the address bars. You break one of the image paths on purpose, you reload, and you use the server log to find the file that the browser could not find.