Chapter 1 · Day 1 · ~10 min

How the Web Works

Every website you have ever visited is made of a few text files. Let's open the box and look inside. No coding experience needed.

In this chapter you will

What happens when you open a website?

You type an address and a page appears. It feels like magic, but it's really a short conversation between two computers. Click through it step by step.

Your browser on your laptop or phone
① Request
“Please send me the home page”
② Response
“Here are the files!”
The server a computer that is always on and stores the website
index.htmlstyle.cssscript.jsphoto.jpg

① Your browser sends a request to the server. ② The server sends back a response: the website's files. ③ Your browser reads the files and draws the page.

🌐 Browser

The app you use to visit websites: Chrome, Firefox, Safari, Edge…

🗄️ Server

A computer somewhere in the world that is always on and stores a website's files.

🏷️ URL

A website's address, like www.example.com. It tells your browser which server to ask.

Think of a restaurant You (the browser) order from the waiter. The kitchen (the server) prepares your dish (the files). The waiter brings it to your table. The URL is simply the restaurant's address.

A website is just files

The server sends plain text files. Each file is written in one of three languages, and each language has one job. Think of building a house:

Structure

HTML

The walls, rooms and doors.

Says what is on the page: headings, text, pictures, buttons. File: index.html

<h1>Hello!</h1>

Style

CSS

The paint, wallpaper and furniture.

Says how it looks: colours, fonts, sizes, spacing, layout. File: style.css

h1 { color: purple; }

Behaviour

JavaScript

The electricity: lights, doorbell, heating.

Makes things happen when you click, type or wait. File: script.js

button.onclick = sayHi;

HTML stands for HyperText Markup Language and CSS for Cascading Style Sheets. You don't need to remember that! Just remember the jobs: structure, style, behaviour.

See the three layers in action

Here is one small profile card. Add one layer at a time and watch what changes.

profile-card.html · HTML only

HTML only. All the content is there: name, text, tags and buttons. But it uses the browser's plain default look.

The code behind each layer

This is the real code running in the card above. You don't need to understand every line. Just notice how different the three languages look.

HTML = the content. Words between angle brackets like <h1> are tags. They tell the browser what each piece is.

<div class="card">
  <div class="avatar">🧑‍🎨</div>
  <h1>Alex Rivera</h1>
  <p class="role">Design student · Erasmus in Porto</p>
  <p>I love photography, street food and building small websites with AI.</p>
  <ul class="tags">
    <li>📷 Photos</li>
    <li>🍜 Food</li>
    <li>🌍 Travel</li>
  </ul>
  <button id="like">❤️ Like <span id="count">12</span></button>
  <button id="mode">🌙 Dark mode</button>
</div>

CSS = the look. Each rule picks some elements (for example .card or button) and gives them a style between { }.

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: system-ui, sans-serif;
  background: linear-gradient(135deg, #ffe3a3, #e4d8ff);
}
.card {
  width: 290px;
  padding: 22px;
  text-align: center;
  background: white;
  color: #1f1140;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(31, 17, 64, 0.2);
  transition: background 0.3s, color 0.3s;
}
.avatar {
  width: 68px;
  height: 68px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 38px;
  background: #fff4d9;
  border-radius: 50%;
}
h1 { margin: 10px 0 0; font-size: 24px; }
.role { margin: 2px 0 10px; color: #6b6386; font-size: 14px; }
.tags { list-style: none; padding: 0; display: flex; justify-content: center; gap: 6px; }
.tags li { background: #efe9ff; color: #2d1b5c; padding: 4px 10px; border-radius: 99px; font-size: 13px; }
button {
  border: 0;
  margin: 4px;
  padding: 10px 16px;
  border-radius: 99px;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  background: #2d1b5c;
  color: white;
}
#mode { background: #f5a300; color: #2a1a00; }

/* These two styles are switched on by JavaScript */
.liked { background: #e0245e; }
.card.dark { background: #1f1140; color: #f1eefb; }
.card.dark .role { color: #cfc6ee; }

JavaScript = the behaviour. It finds parts of the page, waits for a click, then changes something. The lines starting with // are notes for humans.

// 1. Find the parts of the page we need
const card = document.querySelector('.card');
const likeButton = document.querySelector('#like');
const countText = document.querySelector('#count');
const modeButton = document.querySelector('#mode');

let likes = 12;
let liked = false;

// 2. When someone clicks "Like": add or remove one like
likeButton.addEventListener('click', () => {
  liked = !liked;
  if (liked) {
    likes = likes + 1;
  } else {
    likes = likes - 1;
  }
  countText.textContent = likes;
  likeButton.classList.toggle('liked', liked);
});

// 3. When someone clicks the mode button: switch dark mode on or off
modeButton.addEventListener('click', () => {
  card.classList.toggle('dark');
  if (card.classList.contains('dark')) {
    modeButton.textContent = '☀️ Light mode';
  } else {
    modeButton.textContent = '🌙 Dark mode';
  }
});

One file or three? In big projects, the three languages usually live in three separate files. For small pages they can also share one single HTML file: CSS goes inside a <style> tag and JavaScript inside a <script> tag. That's exactly how DigiBot builds your pages.

Quick check: the Like button is on the page and it looks great, but nothing happens when you click it. Which layer is missing?

Anatomy of an HTML tag

HTML is made of tags, labels in angle brackets < > that wrap around your content. Here is a link. Tap or hover over each coloured part, or use the buttons below it.

👆 Pick a part of the tag to see what it does.

Opening tag <a …> starts the element. The letter a is short for anchor, which means a link. Everything up to the closing tag belongs to this link.

Attribute name Extra information, written inside the opening tag. href says where the link goes. class gives the element a name that CSS can use to style it.

Attribute value The setting for that attribute, always inside quotes. Here the link goes to the page contact.html, and it gets the CSS style called btn.

Content What the visitor actually sees on the page and clicks: the words Contact me.

Closing tag </a> ends the element. Same name, plus a slash /. A forgotten closing tag is a classic bug, and AI sometimes forgets them too!

In the browser, the visitor only sees: Contact me

Opening tag + content + closing tag together make one element. A web page is simply elements inside elements, like boxes inside boxes.

6 tags you will see everywhere
TagWhat it isExample
<h1> to <h6>Headings, from biggest (h1) to smallest (h6)<h1>Welcome!</h1>
<p>A paragraph of text<p>Hi there.</p>
<a>A link to another page<a href="menu.html">Menu</a>
<img>A picture. It has no closing tag!<img src="cafe.jpg" alt="Our café">
<button>A button people can click<button>Book now</button>
<section>, <div>Boxes that group other elements together<section>…</section>

Look at this image tag: <img src="cat.jpg" alt="A sleeping cat">. What is alt?

Your turn: edit a real web page

This is a complete tiny web page: HTML with a bit of CSS inside <style>. Change the code on the left and the page on the right updates as you type.

Colours in CSS You can use about 140 colour names (tomato, teal, gold…) or hex codes like #ff6600: a # followed by six characters that mix red, green and blue. Broke something? Click Reset. Nothing you do here can damage anything.

Peek inside any website

Every website sends its HTML, CSS and JavaScript to your browser. So you can look at the code of any site. Two tools let you do it:

View source

Shows the raw HTML that the server sent. Good for seeing how a page is built.

DevTools (Developer Tools)

A toolbox built into every desktop browser. Click any element to see its HTML and CSS, try changes live, and read JavaScript error messages in the Console tab.

  • View source: Ctrl + U
  • Open DevTools: F12 or Ctrl + Shift + I
  • Pick an element to inspect: Ctrl + Shift + C
  • Or: right-click anything on the page → Inspect

On some laptops you need to hold Fn to use F12. Works in Chrome, Edge and Firefox.

  • View source: ⌥ Option + ⌘ Cmd + U
  • Open DevTools: ⌥ Option + ⌘ Cmd + I
  • Pick an element to inspect: ⌘ Cmd + ⇧ Shift + C
  • Or: Control-click (or two-finger click) anything → Inspect

Works in Chrome and Edge. In Safari, first turn on Settings → Advanced → Show features for web developers. In Firefox, view source is ⌘ Cmd + U.

Try it right now (on a laptop) Open DevTools on this page. Click the arrow icon in the top-left corner of DevTools, then click the big heading “How the Web Works”. In the Elements panel, double-click the heading text and type something new.

Only you see the change, and it disappears when you refresh. You can't break a website this way. On phones, DevTools are hidden, so use a laptop for this one.

Where does AI fit in?

AI tools like DigiBot can write HTML, CSS and JavaScript for you in seconds. So why learn these words? Because you are the director. AI is a very fast builder, but it has never seen your plan. It only knows what you tell it.

When you know the words (heading, button, the CSS, the JavaScript) you can give clear instructions and check the result.

😕 Without the words

“Make it look nicer.”

The AI has to guess. It may change everything, even the parts you liked.

😎 With the words

“In the CSS, make the h1 heading dark purple and give the buttons rounded corners. Don't change the HTML.”

The AI knows which layer, which element, and what to leave alone.

You're in charge, AI is your assistant In this workshop you'll follow a simple loop: Plan → Prompt → Review → Fix → Iterate → Publish. The words from this chapter help you in every step, especially Review and Fix (Chapter 6).

Words you now know

Browser
The app that asks for web pages and draws them.
Server
The always-on computer that stores and sends the files.
URL
A website's address.
HTML
Structure: what is on the page.
CSS
Style: how it looks.
JavaScript
Behaviour: what happens when you click or type.
Tag & element
<p>…</p>: tags wrap content to make an element.
Attribute
Extra info inside a tag, like href="…".
DevTools
The browser's built-in toolbox for looking inside pages.

Forgot a word later? Look it up in the Glossary.

Your turn Open any website you like and press Ctrl + U (Mac: ⌥ ⌘ U). Find the <title> tag near the top: that's the text on the browser tab!

You now speak a little “web”. Next, meet the free AI tools that can write all of this for you: Chapter 2: Your Free AI Toolbox →