The time has come to bring together everything you've learnt and create the first real page of the project: The Blue Cup's index.html. This lesson doesn't introduce any new syntax; it's about practising the complete workflow that you will repeat thousands of times as a developer: create the file, write the structure, add content, save, view it in the browser, inspect it with DevTools, make changes and reload. At the end you will have the complete document explained line by line.

Contents

  1. What you are going to build
  2. Step 1: create the index.html file
  3. Step 2: write the document structure
  4. Step 3: add the tab title
  5. Step 4: add the heading and the welcome paragraphs
  6. Step 5: save and open in the browser
  7. Step 6: inspect with DevTools
  8. Step 7: make changes and reload
  9. The final document explained line by line

What you are going to build

When you finish, your project folder will look like this:

the-blue-cup/
└── index.html

And the page will display:

  • In the browser tab: Home | The Blue Cup.
  • A main heading: The Blue Cup.
  • Two welcome paragraphs introducing the café and its opening hours.

It's a simple page, but it is complete and correct: it follows all the structural rules you have studied. From here on, the remaining modules will gradually enrich it.

flowchart LR
    A[Create file] --> B[Write HTML]
    B --> C[Save]
    C --> D[View in browser]
    D --> E[Inspect with DevTools]
    E --> F{Is it right?}
    F -- No --> B
    F -- Yes --> G[Next change]
    G --> B

This edit → save → view → review cycle is the day-to-day reality of web development. The shorter it is (which is why we use Live Server), the faster you will learn.

Step 1: create the index.html file

  1. Open VS Code and open the project folder: File > Open Folder… > the-blue-cup.
  2. In the Explorer panel (left side bar), hover over the folder name and click the New File icon (a sheet of paper with a +).
  3. Type the name index.html and press Enter.

Important details:

  • The name is index.html, all in lower case. This name has a special meaning for web servers, which you will see in File Organisation and Paths.
  • The .html extension is what tells the system and the browser that this is an HTML document. (There is also .htm, an old variant; always use .html.)
  • Notice that the file icon in VS Code changes once it recognises the extension, and HTML appears as the language in the status bar at the bottom.

If you created test.html in the exercise in the lesson Setting Up Your Work Environment, you can delete it now (right-click > Delete).

Step 2: write the document structure

With index.html open and empty, write the basic structure. You can use the Emmet shortcut (! + Tab) and correct whatever is needed, but we recommend typing it by hand this first time: that way each part will stick in your memory.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
  </body>
</html>

Mentally review what you learnt in Basic Structure of an HTML Document:

  • The doctype on the first line, to trigger standards mode.
  • html as the root, with lang="en" because the content is in English.
  • head with the UTF-8 encoding as its first element and the meta viewport (explained in Module 9).
  • body, still empty.

If you used Emmet, check two things: that lang="en" is present (Emmet's default, and correct for this page) and that Emmet adds a title with the text Document, which you are going to change in the next step.

Step 3: add the tab title

Inside head, after the meta elements, add the title:

    <title>Home | The Blue Cup</title>

Why this text?

  • "Home" comes first because it is the part specific to this page. When the user has several tabs from the site open, they will see the beginning of the title.
  • "The Blue Cup" goes at the end as the site name. The other pages will follow the same pattern: Menu | The Blue Cup, Bookings | The Blue Cup…
  • The vertical bar | is just a common separator; dashes (–) are also used.

Step 4: add the heading and the welcome paragraphs

Now, inside body, add the visible content:

    <h1>The Blue Cup</h1>
    <p>Welcome to The Blue Cup, your neighbourhood café and bakery. We roast speciality coffee and every morning we bake bread, croissants and sponge cakes in our own bakery.</p>
    <p>We look forward to seeing you every day from 8:00 to 20:00 at 12 Example Street, Fictional Town.</p>
  • h1 is the page's main heading. Normally there is one per page and it describes the page's main content; here, the name of the café.
  • Each p is a paragraph. We have used two because they deal with different ideas: what the café is, and when and where to find it.

Don't worry yet about the different heading levels or how to highlight the opening hours: you will work on those in Module 2 (Headings and Paragraphs and Text Formatting Tags).

Remember about whitespace: long paragraphs can take up a single line in the editor or several; the browser will display them the same way. If you'd like the editor to wrap long lines visually without changing the file, enable View > Word Wrap (Alt+Z).

Step 5: save and open in the browser

  1. Save with Ctrl+S (Cmd+S on macOS). The dot on the editor tab disappears once the file is saved.
  2. Open the page in one of these ways:
    • Live Server: the Go Live button in the status bar, or right-click index.html > Open with Live Server.
    • Double-click index.html in your system's file explorer.

You should see:

  • In the tab: "Home | The Blue Cup".
  • Large bold text: "The Blue Cup".
  • Two paragraphs of normal text, separated by some vertical space.

It looks plain (serif typeface, white background, black text) because these are the browser's default styles. That's normal: there is no CSS yet. Notice too that the "é" in "café" displays correctly: that's thanks to <meta charset="utf-8">.

If something doesn't look right

Symptom Likely cause Solution
The HTML code is displayed as text The file is called index.html.txt or index.txt Rename it to index.html and turn on file extensions in your file explorer
Strange characters (é) instead of accented letters meta charset is missing or the file isn't in UTF-8 Check the head and the encoding in VS Code's status bar
The tab shows index.html or Document The title is missing or you didn't change it Add or correct the title inside head
Changes don't appear You didn't save or didn't reload Ctrl+S and, if you're not using Live Server, F5
All the text is large The closing </h1> is missing Close the heading before the first <p>

Step 6: inspect with DevTools

Now examine your own page as you learnt in Setting Up Your Work Environment:

  1. Right-click the heading "The Blue Cup" > Inspect.
  2. The Elements panel will open with the h1 selected. Look at the tree: html contains head and body; body contains h1 and two p elements.
  3. Expand head with the triangle: you will see the two meta elements and the title.
  4. Hover over each p in the panel: the corresponding paragraph is highlighted on the page, together with the space around it.
  5. Press Ctrl+U to view the source code: it is exactly what you typed, with your indentation.

A useful experiment: temporarily delete the </h1> in the editor, save and go back to the Elements panel. You will see that the browser has "repaired" the document in its own way (usually closing the h1 in an unexpected place or putting the paragraphs inside it). Compare it with the source code, which shows the error as it is. Afterwards, restore the </h1> and save.

Step 7: make changes and reload

The last step of the cycle is to iterate. Make these changes one at a time, saving and watching the browser after each one:

  1. Add the sentence "You can also call us on +34 900 000 000." to the end of the second paragraph.
  2. Add a third paragraph with the text: "Email us at [email protected] and we'll get back to you as soon as possible."
  3. Add a comment just before the h1: <!-- Welcome: home page -->. Check that it doesn't appear on the page but does appear in the source code.

With Live Server, each Ctrl+S updates the page automatically. Without it, remember to reload with F5. If the browser ever seems to be showing an old version, force a reload with Ctrl+F5 (Cmd+Shift+R on macOS), which bypasses the cache.

The final document explained line by line

This is the complete index.html after the steps above. Type it out or compare it with yours:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Home | The Blue Cup</title>
  </head>
  <body>
    <!-- Welcome: home page -->
    <h1>The Blue Cup</h1>
    <p>Welcome to The Blue Cup, your neighbourhood café and bakery. We roast speciality coffee and every morning we bake bread, croissants and sponge cakes in our own bakery.</p>
    <p>We look forward to seeing you every day from 8:00 to 20:00 at 12 Example Street, Fictional Town. You can also call us on +34 900 000 000.</p>
    <p>Email us at [email protected] and we'll get back to you as soon as possible.</p>
  </body>
</html>
Line Code Explanation
1 <!DOCTYPE html> Declares a modern HTML document and triggers standards mode
2 <html lang="en"> Opens the root element and states that the content is in English
3 <head> Opens the metadata section (nothing here is visible on the page)
4 <meta charset="utf-8"> UTF-8 encoding: accented letters, € and £ display correctly
5 <meta name="viewport" …> Adapting to mobile screens (Module 9)
6 <title>Home | The Blue Cup</title> Text for the tab, bookmarks and search engine results
7 </head> Closes the head
8 <body> Opens the body: the visible content begins
9 <!-- … --> Comment for whoever reads the code; the browser ignores it
10 <h1>The Blue Cup</h1> The page's main heading
11 <p>Welcome…</p> First paragraph: what the café is
12 <p>We look forward…</p> Second paragraph: opening hours, address and phone number
13 <p>Email us…</p> Third paragraph: contact email
14 </body> Closes the body
15 </html> Closes the root element: end of the document

Notice that the phone number and the email address are, for now, plain text. In Module 3 (Special Links: Anchors, Email, Phone and Downloads) you will turn them into links that open the phone app or the email program.

Common Mistakes and Tips

  • Working on a file outside the project folder: check in the VS Code explorer that index.html sits directly inside the-blue-cup/.
  • Writing content outside body: everything visible goes between <body> and </body>. If you write text after </html>, the browser will still display it, but it's an error.
  • Several h1 elements "to make it look big": the h1 is the main heading, not a sizing tool. Size is controlled with CSS.
  • Using Enter to separate paragraphs: line breaks in the code aren't visible; each paragraph needs its own p element.
  • Editing in DevTools and closing the browser: the changes are lost. The file in your editor is the single source of truth.
  • Tip: save often and check the result after each small change. If you make ten changes before looking and something breaks, it will be harder to find the error.

Exercises

Exercise 1. A standalone test page. Without looking at the lesson, create a file opening-hours.html outside the project with a complete structure, the title "Opening Hours | The Blue Cup", an h1 with the text "Opening Hours" and two paragraphs: one for Monday to Friday (8:00 to 20:00) and another for weekends (9:00 to 14:00). Open it in the browser and check it with DevTools.

Exercise 2. Diagnose the problem. A colleague sends you this index.html and says that "the tab says index.html, the accented letters come out wrong and all the text is huge". Find the causes.

<!DOCTYPE html>
<html lang="en">
  <head>
  </head>
  <body>
    <title>Home | The Blue Cup</title>
    <h1>The Blue Cup
    <p>Speciality coffee and handmade pastries at our café.</p>
  </body>
</html>

Exercise 3. Extend your index.html. Add a paragraph to the home page, before the email one, introducing the coffee of the week (make up the name and origin) and use a title attribute on it with some supplementary information. Check the tooltip in the browser.

Solutions

Solution 1.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Opening Hours | The Blue Cup</title>
  </head>
  <body>
    <h1>Opening Hours</h1>
    <p>Monday to Friday, from 8:00 to 20:00.</p>
    <p>Saturdays and Sundays, from 9:00 to 14:00.</p>
  </body>
</html>

If you wrote it from memory without errors, you have internalised the structure. If you forgot the charset or the lang, go back over Basic Structure of an HTML Document.

Solution 2.

  • "The tab says index.html": the title is inside body instead of head. (The browser may move it, but it isn't correct; move it to head.)
  • "The accented letters come out wrong": <meta charset="utf-8"> is missing from head.
  • "All the text is huge": the h1 isn't closed, so the paragraph ends up inside the heading. A </h1> is missing after "The Blue Cup".
  • In addition, the meta viewport is missing.

Solution 3. One possible solution (the paragraph goes between the opening hours one and the email one):

    <p title="Medium roast, notes of chocolate and orange">This week we recommend our Colombian coffee, ideal black or with milk.</p>

When you hover over the paragraph, a box will appear with the roast information. Remember that title shouldn't contain essential information, since it can't be seen on mobile devices.

Conclusion

You have created the first real page of the project: the-blue-cup/index.html, with its complete structure, a descriptive title, the main heading and several welcome paragraphs. Above all, you have practised the working cycle of any web developer: edit, save, view in the browser, inspect with DevTools and correct. Right now the project is a single file; but a real website has several pages, stylesheets, images and videos. In the next lesson, File Organisation and Paths, you will set up The Blue Cup's folder structure and learn to write the paths that connect files to one another.

HTML Course

Module 1: Introduction to HTML

Module 2: Text Formatting in HTML

Module 3: Links and Media in HTML

Module 4: Tables in HTML

Module 5: Forms in HTML

Module 6: HTML5 Semantic Elements

Module 7: Advanced HTML Techniques

Module 8: Integrating HTML and CSS

Module 9: Responsive Web Design

Module 10: Best Practices and Accessibility

Module 11: Project: Building a Complete Website

© Copyright 2026. All rights reserved