← Projects/Tutorials/Your first website
Web Path · Level 1 · Getting started

Your first website

In eight short chapters you build your own page with text, a picture, a table and a menu. All you need is a computer running Windows.

Beginner8 chaptersfreeNew, not yet tested with children

This tutorial is freshly written. Menu names in Windows may differ slightly depending on the version. If you notice anything, I would love to hear from you.

Start

This guide is for Windows. Your own page grows with every chapter.

Don't worry, you can't break anything. If something doesn't work, that is normal and part of it. Look closely at what is different from the example, and try again.

A chapter takes about ten to fifteen minutes. That is an estimate and has not yet been measured with children. You do not have to do everything in one day.

Like a house

A website is like a house:

Assembly planWhere your page lives right now

Everything stays on your computer. Only you can see the page.

Editoryou write
index.htmla text file
Your folderon your computer
Browserreads and shows
Only youcan see the page
Assembly planHow it would get onto the internet (chapter 7)

A server is a computer that never sleeps. It shows your page to everyone who knows the address.

Your folderfinished and tidy
Uploadto a service
Servera computer that is always on
Addressthe domain, like a house address
Othersopen the address in their browser

Like a letter: the house is the server, the house address is the domain, and the browser is the postman who finds the way.

What you need

Nothing else. It costs nothing, and you do not need to install anything.

Your topic

Think about what your page should be about. For example your pet, your hobby or your favourite game. In the examples the page is called George, my cat. Pick your own topic and replace “George” everywhere.

How to support your child (for parents)

Sit down together at the computer at the start; after that your child can often manage alone. If something does not work, help with questions (“What looks different to you?”) rather than with the answer. If asked, show how to make file extensions visible. Or go through the steps together. If you learn along with them, even better.

Right now only you can see the page. What goes on the internet is something you decide together.

The chapters

  1. Under the bonnet: You take a look behind the scenes of a page.
  2. Hello World: Your first file that a browser can read.
  3. Text and pictures: More text, a picture and a tidy folder.
  4. Links: A second page and ways between them.
  5. Lists and tables: Bringing order to your content.
  6. Menu: A bar that connects all your pages.
  7. Showing and testing: What does your page look like on other devices?
  8. Online: A look at how a page gets onto the internet, with your parents.

You can swipe or scroll long lines in the example code sideways. Type everything out yourself. That is the best practice. A typo breaks nothing and shows you what matters.

Chapter 0: Under the bonnet

Assembly planWhat happens with F12

You see the text behind the page. You can only change your own copy.

Serverexample.org, the real page
Internetsends a copy
Your browsershows the copy
F12you change the copy
F5fetches a fresh copy, everything as before
  • Browser
  • F12 key
  • F5 key
  • example.org

Before you build anything, you take a look behind the scenes. Every website is made of text that your browser reads and turns into a page. You can look at this text and even change it, but only on your own screen.

Don't worry, you can't break anything. You only change your own view, never the real page. Reloading with F5 puts everything back.

Step 1: Open a page

Open your browser and type example.org into the address bar at the top. It is a page made specially for examples. You will see a short page with a heading.

Step 2: Look under the bonnet

Press F12. A new panel full of text with angle brackets opens at the side. These are the tags, the instructions the page is built from. There you will find, for example, <h1>. That is the big heading you are about to write yourself.

Step 3: Change some text

In the new panel, double-click the text between <h1> and </h1>. Delete it, type something of your own, for example George is the boss, and press Enter. Look at the page: the heading has changed.

Step 4: Put everything back

Press F5. The page reloads, and everything is as it was. You only changed your own view. The real page never changed.

For parents

Here your child sees that web pages are made of text and that changes in the browser only apply locally. It is best to choose a harmless page such as example.org. Pages with logins or payments are not needed for this.

What you have seen: A web page is text, and you can read it.

Try it out: Pick another harmless page with your parents, open the panel with F12 and change a word. What happens after F5?

Next up: Now you build something yourself.

Chapter 1: Hello World

Assembly planFrom note to web page

With the ending .html, a text file becomes a page the browser shows.

Foldergeorge
Editortype the frame
indexa note with raw text
index.htmlrenamed, now a plan
Browserdouble-click shows the page

If the file is called index.html.txt, it will not open as a web page. Choose “All files” when saving.

  • Notepad
  • a new folder
  • file type “All files”
  • file name extensions visible

Step 1: Your folder

Make a new folder on the computer. Name it after your topic, for example george. This is where your page lives.

Step 2: Your file

Open the editor and choose File, Save as. At the bottom it says “Save as type”. Open the menu and choose “All files (*.*)”. If it says “Text documents (*.txt)”, the editor adds .txt to the name on its own.

Name the file exactly index and save it in your folder. Just index, nothing else. Later we will turn it into an HTML file.

Step 3: Your text

Type this out, line by line:

index<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>George, my cat</title>
</head>
<body>
  <h1>Hello World!</h1>
  <p>This is my first page.</p>
</body>
</html>

Type every line yourself. A missing < or > is enough to make something look different. That happens to everyone, and it is exactly how you learn.

What sits between <body> and </body> is what you see. <h1> is the big heading (heading 1), </h1> ends it. <p> is a paragraph.

The line <meta charset="UTF-8"> tells the browser how to read special characters such as ä, ö and ü. Without it they can look wrong, for example as a jumble of symbols. That is why we always keep it in.

What else is in the frame? (to read up on)
  • <!DOCTYPE html> is not an instruction to draw something but an announcement: “This is an HTML page.” It always goes right at the top.
  • <html lang="en"> wraps the whole page. lang="en" tells the browser that the language is English. For a German page you would write lang="de".
  • <head> is the invisible head. Nobody sees what is in it, but the browser needs it.
  • <body> is the stage. Everything you see goes here.

Save the file. The same applies here: save as type “All files”, name index.

Step 4: From a note to a blueprint

So far your file is a note: there is only plain text on it, without colours, font sizes or pictures. An HTML file is the same text file, but the computer recognises it by the extension .html and opens it not with the editor but with the browser. The browser reads the tags, hides them and draws the finished page.

  1. Make extensions visible. Open your folder in File Explorer. Go to View and switch on “File name extensions”. Otherwise Windows often hides extensions.
  2. Check. Your file must now be called exactly index, with nothing after it. If it says index.txt, you chose “Text documents” when saving. That is no problem: in the next step you replace the whole name.
  3. Rename. Right-click the file, Rename, type index.html. The computer asks whether you really want to change the extension. Answer Yes.
  4. Double-click. The browser opens and shows your page. That is your very first website.

Why not index.html straight away?

Because with “Text documents (*.txt)” the editor automatically adds .txt. index.html then becomes index.html.txt, and the browser does not open the file as a web page. That is the most common mistake the first time. The tricky part: if Windows hides extensions, index.html.txt looks like index.html in the folder. That is why we make the extensions visible first.

index is the usual name for the home page of a website, which is why the file is called that.

What you have built: A file that a browser can read. That is the start of every website.

Try it out: Change “Hello World!” to something of your own, save (type “All files”, name index.html) and reload the browser (key F5). What happens?

Next up: Text and a picture.

Chapter 2: Text and pictures

Assembly planThe path to the picture

The path in src leads from index.html into the folder images to the picture.

index.html<img src="…">
images/the subfolder
george.jpglower case, no spaces
Browsershows the picture

One wrong letter in the path: the alt text appears instead of the picture.

  • subfolder images
  • a picture, chosen with your parents
  • h2 p strong img

In this chapter your page gets more text and a picture. Don't worry, you can't break anything. If your picture does not appear, that is the best exercise in this chapter.

First: ask your parents

Which pictures may you put on your page? To start with, use pictures of animals, objects or your own drawings. Pictures of people, including yourself, only if your parents say yes. Right now only you can see the page. If it goes on the internet later, anyone can see it, and pictures on the internet can stay there.

Step 1: Open the file for editing

A double-click now opens index.html in the browser, not in the editor. To edit it: right-click the file, Open with, Notepad.

Step 2: Subfolder and picture

Right-click in the folder, New, Folder, name it images. Copy your picture into it. Give it a simple name without spaces, for example george.jpg.

This keeps everything easy to find:

  1. Write everything in lower case.
  2. No spaces; use a hyphen instead (george-sofa.jpg).
  3. No umlauts or special characters in file names.
  4. Meaningful names, not IMG_4821.jpg.

Why so strict? On Windows, upper and lower case in file names does not matter; on many servers on the internet it does. A page that works on your computer can lose a picture online just because it says George.jpg instead of george.jpg.

Step 3: Add text and a picture

Type this between <body> and </body>, below your heading:

index.html<h2>About George</h2>
<p>George is a cat. She <strong>loves</strong> sleeping on the sofa.</p>
<img src="images/george.jpg" alt="George lying on the sofa">

Step 4: Save and have a look

Save (type “All files”, name index.html) and reload the page in the browser (key F5). Your picture appears.

If the picture is missing

Then your alt text appears instead, and that is a clue. Check: is the file named exactly as in src, including upper and lower case? Is it in the images folder? Is the extension visible, and is the file perhaps called george.jpg.jpg?

This is what your folder looks like now

Foldergeorge/
├── index.html
└── images/
    └── george.jpg

What you have built: A page with headings, text, bold writing and a picture, in a tidy folder.

Try it out: Deliberately change a letter in the path, for example leave out images/, and see what happens. Then fix it.

Next up: A second page and links between them.

Chapter 3: Links

Assembly planPaths between pages

A link is a path. href says where it leads.

index.htmlstart page
toys.htmlsecond page, with a way back
Another websitelives on someone else's server

The name in href must match exactly, otherwise you get “file not found”.

  • second file
  • <a href>
  • a link back

So far your site has a home page. Now it gets a second page, and a click takes you from one to the other. Don't worry, you can't break anything. If a link does not work, that is the best exercise in this chapter.

Step 1: The second page

Open the editor, choose File, Save as, the type “All files” and name the file toys.html. Save it in the same folder as index.html.

Type the frame out again, as in chapter 1. That is the best practice. If you are in a hurry, you may copy it instead: in index.html select everything (Ctrl and A), copy (Ctrl and C), paste into the new file (Ctrl and V). Then change the title, heading and text. Tip: type the frame yourself at least once, then you know what is in it.

toys.html<h1>George’s toys</h1>
<p>George’s favourite toy is the red ball.</p>

Step 2: The link from the home page

Open index.html (right-click, Open with, Notepad) and type below the text:

index.html<p><a href="toys.html">George’s toys</a></p>

<a> stands for anchor. href is the destination, the path to the file, just like with pictures. The text in between is what you click on.

Step 3: The way back

The link back goes into toys.html:

toys.html<p><a href="index.html">Back to the home page</a></p>

Step 4: Click

Save both files and open index.html in the browser. Click the link. You land on your own second page and can get back again with the return link. That is your own little web.

A link to another website

With https:// and an address, a link also leads out onto the internet:

index.html<p><a href="https://example.org">An example page</a></p>

example.org is a page made specially for examples and shows nothing unexpected.

For parents

Decide together which pages your child links to. With a link to the internet, you only see what is there after clicking.

If the link does not work

The browser shows an error page (“File not found”). Check: is the file named exactly as in the href, in lower case and with .html? Is it in the same folder?

This is what your folder looks like now

Foldergeorge/
├── index.html
├── toys.html
└── images/
    └── george.jpg

What you have built: Two pages that link to each other.

Try it out: Deliberately write toys.htm instead of .html in the href, click and read the error message. Then fix it.

Next up: Lists and tables.

What comes next?

Your page is still plain. That is on purpose, so you understand how everything is built. Examples that you can make yourself later will come with the next tutorial, “Making it beautiful”.

There are countless ways to express yourself, and you can be very creative. But more on that later. First we build the foundation. Once it stands, we decorate it.

Chapter 4: Lists and tables

Assembly planWhich list, which table?

If the order matters, use ol. If it does not, use ul. For a profile, use table.

Your itemsDoes the order matter?
Answer
Yes: olnumbered list
No: ulbullet list
Tabletable
Rowtr
Cellsth heading, td content

Every tag needs its end: </li>, </tr>, </table>.

  • ul ol li
  • table tr th td

Now your content gets some order: a bulleted list, a numbered ranking and a table. Don't worry, you can't break anything. If something looks odd, usually just a closing tag is missing, and you will find it.

Open the files for editing as before: right-click, Open with, Notepad. Save with the type “All files”.

Step 1: A bulleted list

In index.html, type below the text about George:

index.html<h2>George’s favourite spots</h2>
<ul>
  <li>the sofa</li>
  <li>the balcony</li>
  <li>the windowsill</li>
</ul>

<ul> is a list without order (unordered list). <li> is a single item (list item).

Step 2: A ranking

If the order matters, you use a numbered list. In toys.html, type below the text:

toys.html<h2>George’s top toys</h2>
<ol>
  <li>the red ball</li>
  <li>the toy mouse</li>
  <li>the cardboard box</li>
</ol>

<ol> is a numbered list (ordered list). Remember: if the order matters, use ol. If it does not, use ul.

Step 3: A table

In index.html, type a profile below the list:

index.html<h2>Profile</h2>
<table border="1">
  <tr>
    <th>Name</th>
    <td>George</td>
  </tr>
  <tr>
    <th>Species</th>
    <td>Cat</td>
  </tr>
  <tr>
    <th>Favourite spot</th>
    <td>the sofa</td>
  </tr>
</table>

Step 4: Have a look

Save both files and reload the pages in the browser (F5). A few lines of text have become a neat table.

If something looks odd

Check that every tag has an end: every <li> a </li>, every row a </tr>, the table a </table>. Count the opening and closing tags. That is the most common source of mistakes.

What you have built: A list, a ranking and a table about your own topic.

Try it out: Add a fourth item and another row to the table. Then swap ol for ul and see what happens to the numbers.

Next up: A menu that connects all your pages.

Chapter 5: Menu

Assembly planOne menu for all pages

The same menu is on every page. That way you can get anywhere from anywhere.

Menu<nav>
at the top of every page
index.html
toys.html
diary.html

If the menu is missing on one page, you cannot get away from there.

  • third page diary.html
  • nav ul li a
  • copy and paste

So far you get from page to page through single links. Real websites have a menu that is the same on every page. You are building that now. Don't worry, you can't break anything. The menu is made only of links you already know.

Step 1: A third page

For the menu to connect something, you need a third page. Save a new file diary.html in the same folder (type “All files”). Type the frame again or copy it from another page. In between goes:

diary.html<h1>George’s diary</h1>
<p>Today I had a long sleep on the sofa.</p>
<p>In the afternoon I chased the red ball.</p>

Step 2: The menu

In index.html, type directly below <body>, even before the heading:

index.html<nav>
  <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="toys.html">Toys</a></li>
    <li><a href="diary.html">Diary</a></li>
  </ul>
</nav>

<nav> comes from navigation. It tells the browser: “This is the menu.” Inside it is a list, and every item is a link, as in chapter 3. At the moment it still looks like a bulleted list. With CSS it will become a bar later.

Step 3: On every page

A menu is only useful if it is on every page. Copy it (Ctrl and C) and paste it into toys.html and diary.html directly below <body> (Ctrl and V). Copying is completely normal here; the professionals do it too. You no longer need your old “back” links; you can delete them.

Step 4: Click

Open index.html in the browser and click through all three pages. From every page you can get anywhere. Your pages now feel like a real website.

If the menu is missing or a link does not work

Is the menu on every page? If it is missing on one, you cannot get away from there. Are the file names in every href exactly right, in lower case and with .html?

This is what your folder looks like now

Foldergeorge/
├── index.html
├── toys.html
├── diary.html
└── images/
    └── george.jpg

What you have built: Three pages with a shared menu.

Try it out: Add a fourth menu item that points to a new page. Remember to add it on every page.

Next up: What does your page look like on other devices?

Chapter 6: Showing and testing

Assembly planOne page, many screens

With the viewport line, every device uses its real width.

index.html<meta name="viewport">
examples, real devices differ
Phoneabout 400 pixels wide
Tabletabout 800 pixels
PCover 1000 pixels

Without the line, the phone pretends to be 980 pixels wide and everything becomes tiny.

  • F12 device view
  • meta viewport

You have built your page and want to show it. Right now a careful look pays off: what does it look like on other devices? Don't worry if it looks different there. That is normal, and you are about to learn why.

Step 1: View the page on a phone

You do not need to fetch a phone for this. Open your page in the browser and press F12, as in chapter 0. In the bar, click the symbol with a phone and a tablet (device view) and choose “phone” at the top. What do you see? The text is tiny. Why?

The answer: devices have different formats

The format is the size and shape of the screen. A phone is narrow and tall, a tablet medium-wide, a laptop or PC wide and landscape. As an example in pixels (picture dots): a phone is about 400 pixels wide, a tablet about 800, a PC over 1000. These are only examples. Real devices can differ.

Your browser does not know by itself that your page may also be narrow. So a phone assumes it needs lots of space (about 980 pixels) and shrinks everything until it fits the narrow screen. That is why the text looks tiny.

Step 2: Tell the phone what you want

The viewing window is called the viewport. We tell the phone: “Use your real width.” Type this line into the <head>, directly below the line with charset, on every page:

index.html<meta name="viewport" content="width=device-width, initial-scale=1.0">

Save (type “All files”, name index.html) and reload the page (F5). Look at the phone view again. The text is large and fits the screen.

For parents

Once the page is online later, look at it together on your phone or tablet. Getting a file from the computer onto a phone without putting it online is awkward. The device view on the computer is enough to start with.

What you have built: A page that adapts to the width of the device.

Try it out: In the device view choose “tablet” and then “laptop”. What changes? Drag the window narrower and wider.

Next up: A look at how your page gets onto the internet.

Chapter 7: Online (a look ahead)

Assembly planServices and servers

Online means: your files sit on a server at a service, and an address leads there.

Your folderfinished and tidy
Uploadonly together with your parents
Server at a servicefor example GitHub Pages
Address
Free addressbelongs to the provider
Own domainyourname.ch, costs every year
Everyonewho knows the address

No full name, no address, no photos of people.

  • Parents
  • a service with a server
  • free address or domain

So far only you can see your page, on your computer. In this chapter you do not build anything. You find out how a page gets onto the internet, and you decide about it together with your parents.

This is a look ahead

I deliberately do not show exact click paths for any particular provider here. I have not yet reliably checked the providers’ terms, for example from what age you may have an account. Your parents set that up and read it through with you.

Two ways, two names

A free address is enough to start with. If the page needs to run reliably, something paid may be worth it later.

What does “on the internet” mean?

Once your page is online, anyone who knows the address can see it. And what has been on the internet once can stay there. That is why this rule applies to everything on your page:

For parents

Decide together whether and when the page goes online. You remain responsible for the page and the accounts, not me and not the provider. Look through the whole page beforehand: texts, pictures and links. I do not give legal advice here.

Your folder is ready

You have already done everything right for your page to work online: short file names in lower case without spaces, a tidy folder and names that match exactly. On many servers on the internet upper and lower case matter; on your Windows computer they do not. That is why the rule in chapter 2 was so strict.

What you have learned: How a page gets onto the internet and what to watch out for.

Try it out: Talk to your parents about whether your page should go online and what may be on it.

Next up on this path: Your page gets colours and fonts (CSS).