30 Mins

1. How the Web Works

Introduction

Before writing a single line of code, you need to understand what actually happens when you type a URL into a browser and press Enter. The answer is more elegant than you might think.

The Client-Server Model

The web is built on a client-server relationship. Your browser (the client) sends a request across the internet to a server — a powerful computer sitting in a data center somewhere in the world. The server reads the request, finds the right files, and sends them back.

You type URL
Browser
→
DNS Lookup
IP Address
→
HTTP Request
GET /index.html
→
Server Response
HTML + CSS + JS
→
Browser Renders
Visible Page

The Holy Trinity of the Web

Every webpage is built from three technologies working together in perfect harmony:

HTML

The skeleton — defines structure and content

CSS

The skin — controls visual appearance

JavaScript

The muscles — adds interactivity and logic

HTTP — The Language of the Web

Browsers and servers communicate using HTTP (HyperText Transfer Protocol). When your browser asks for a page, it sends an HTTP GET request. The server replies with a status code:

  • 200 OK — Everything worked perfectly
  • 404 Not Found — The page doesn't exist on the server
  • 500 Internal Server Error — Something broke on the server
  • 301 Moved Permanently — The URL has changed, follow this new one

Tools You Need

  • VS Code — The most popular code editor, free from Microsoft
  • Chrome DevTools — Press F12 in any browser to inspect any website's code live
  • Live Server extension — In VS Code, this auto-refreshes your browser every time you save a file
Right now: Go to any website, press F12, click the Elements tab, and start clicking on text. You can see and even edit the HTML and CSS of any page on the internet.

Knowledge Check

Ready to test your understanding of 1. How the Web Works?

Back