LESSON 2

How Websites Work

Learning objective: Learn what happens between typing a URL and seeing a web page.

Understand

Before writing more HTML, it helps to know how a page actually reaches your screen.

When you enter a URL, your browser (the client) sends a request to a server. The server responds with files — HTML, CSS, JavaScript, images. The browser then reads the HTML, applies the CSS, runs the JavaScript, and paints the page. This request-and-response cycle is the foundation of the web.

Analogy: It is like ordering at a restaurant: you (the browser) ask the kitchen (the server) for a dish, and it sends back a finished plate (the page).

See It in Action

A simplified view of the flow looks like this:

You type a URL  ->  Browser requests it  ->  Server responds with files
Browser reads HTML  ->  applies CSS  ->  runs JavaScript  ->  shows page
How it works: Each arrow is a step. The browser is the client that asks; the server is the computer that answers with the files that make up the page.

Try It Yourself

  1. Open any website and right-click, then choose 'View Page Source'.
  2. Find one <h1> or <p> tag in the source.
  3. Notice that the page you see is built from that HTML text.

Quick Quiz

In the web request cycle, what does the server do?

Challenge

In one sentence each, describe the job of the browser and the job of the server.

Success condition: You can explain, in your own words, how a page travels from server to screen.