Web Development Basics

Build Your First Website

Learn how websites work through interactive examples. Understand HTML structure, why files stay separate, and where to host your creations - all hands-on!

3 Core Files
5+ Free Hosts
100% Interactive
index.html
1 <!DOCTYPE html>
2 <html>
3   <head>
4     <title>My Site</title>
5   </head>
6   <body>
7     <h1>Hello World!</h1>
8   </body>
9 </html>

What is a Website, Really?

It's simpler than you think

Just Files

A website is just a collection of text files that browsers know how to read and display

Stored Somewhere

These files live on a server (someone else's computer) that's always connected to the internet

Found by URL

When you type a URL, your browser asks that server for the files and displays them

index.html = Home

Every website starts with index.html - it's like the front door that opens first

Interactive Div Playground

Play with HTML elements - resize them, change layouts, see the code update live!

Layout:
Color:
150 x 100
100 x 150
Generated Code

                

Normal Flow

Elements stack based on their display type. Block elements (like divs) stack vertically. This is the default behavior.

The Three Musketeers of Web Dev

Why we keep HTML, CSS, and JavaScript in separate files

index.html

The Skeleton

Defines the structure and content. What elements exist and in what order.

Like the bones of a body

styles.css

The Skin & Clothes

Controls appearance - colors, sizes, fonts, spacing, animations.

Like paint and decoration

script.js

The Brain

Adds interactivity - button clicks, form validation, dynamic updates.

Like the nervous system

See It In Action

Toggle each file to see what happens:

Welcome!

This is a sample card component.

Clicks: 0

Why Keep Them Separate?

Team Work

Designers work on CSS while developers work on JS - no conflicts!

Reusability

One CSS file can style hundreds of HTML pages

Easy Debugging

Style broken? Check CSS. Button not working? Check JS.

Performance

Browsers cache CSS/JS files - faster page loads!

How Your Browser Gets a Website

From typing a URL to seeing the page

1. You Type a URL

example.com

2. DNS Lookup

Finds the server's address

3. Server Responds

Sends index.html first

4. Load Resources

CSS, JS, images follow

5. Render Page

Browser paints the result

Why "index.html"?

It's a convention! When you visit example.com, servers automatically look for index.html in that folder. It's like the "main entrance" of your website. You could name it anything, but index.html is the universal standard.

What is a 404 Error?

Why websites sometimes say "page not found"

You request a page

example.com/about.html

Server looks for it

Searches the folder for about.html

File not found!

Server sends back a 404 status code

Why Does This Happen?

Remember — a website is just files on a server. When you visit a URL, you're asking for a specific file. If that file doesn't exist (typo in the URL, page was deleted, or link is outdated), the server has nothing to send back. Instead of crashing, it sends a 404 status code — the internet's way of saying "I looked, but it's not here."

Why "404" Specifically?

HTTP status codes are how servers talk to browsers. They're grouped by category: 2xx means success (200 = OK!), 3xx means redirect (page moved), 4xx means client error (you asked for something wrong), and 5xx means server error (the server broke). 404 falls in the "client error" group — the URL you typed doesn't match any file on the server.

Common HTTP Status Codes

200 OK — Page loaded successfully
301 Moved — Page has a new URL
403 Forbidden — You don't have permission
404 Not Found — File doesn't exist
500 Server Error — Something broke on their end

Fun Fact

Many websites create custom 404 pages to be helpful (or funny). Instead of a boring error, they show a creative page with a link back to the homepage. It's good practice — if someone lands on a broken link, give them a way to find what they're looking for!

Where to Put Your Website

Free options to get your site online

GitHub Pages

Free
Pros
  • Completely free forever
  • Great for portfolios
  • Custom domain support
  • Git version control
Cons
  • Static sites only
  • 1GB storage limit
  • 100GB bandwidth/month
Best for: Portfolios, documentation, blogs
Visit GitHub Pages

Vercel

Free Tier
Pros
  • Perfect for React/Next.js
  • Instant deployments
  • Preview deployments
  • Serverless functions
Cons
  • Framework-focused
  • Commercial limits
Best for: React, Next.js apps
Visit Vercel

Render

Free Tier
Pros
  • Static + backend support
  • Databases available
  • Simple dashboard
  • Auto HTTPS
Cons
  • Free tier sleeps
  • Cold start delays
Best for: Full-stack beginners
Visit Render

Cloudflare Pages

Free
Pros
  • Unlimited bandwidth
  • Super fast CDN
  • 500 builds/month
  • Workers integration
Cons
  • Fewer features than others
  • Newer platform
Best for: High-traffic static sites
Visit Cloudflare Pages

Quick Comparison

Platform Setup Difficulty Free Bandwidth Backend Support Best For
GitHub Pages Easy 100GB/mo Portfolios
Netlify Easy 100GB/mo Functions Modern Sites
Vercel Easy 100GB/mo Serverless React Apps
Render Medium 100GB/mo Full Full-Stack
Cloudflare Easy Unlimited Workers High Traffic

Don't Want to Code?

Website builders let you create sites without writing code

Not everyone needs to code from scratch! If you just want a website up and running quickly, these drag-and-drop builders are perfect. They handle hosting, security, and updates for you.

Wix

Drag-and-drop editor with 800+ templates. Great for beginners.

Free plan available AI website builder App marketplace
Best for: Small businesses, portfolios
Visit Wix

Squarespace

Beautiful, designer-quality templates. Known for stunning aesthetics.

Premium templates Built-in analytics E-commerce ready
Best for: Creatives, photographers, artists
Visit Squarespace

Webflow

Professional-grade visual builder. Exports clean code if needed.

Full CSS control CMS included Interactions & animations
Best for: Designers, agencies
Visit Webflow

Carrd

Simple one-page sites. Perfect for landing pages and link-in-bio.

Free tier (3 sites) Super simple $19/year Pro plan
Best for: Personal sites, landing pages
Visit Carrd

WordPress

Powers 40% of the web. Massive plugin ecosystem and themes.

Thousands of themes 60,000+ plugins Self-host or WordPress.com
Best for: Blogs, businesses, any site type
Visit WordPress

Code vs No-Code: Which is Right for You?

Learn to Code If...
  • You want full creative control
  • You're building something unique
  • You want a career in tech
  • You enjoy problem-solving
  • You want free hosting options
Use No-Code If...
  • You need a site quickly
  • You're not interested in coding
  • You want built-in support
  • You prefer visual editing
  • Budget for monthly fees is OK

Mini Challenges

Test your understanding with these quick exercises

1

Size It

Easy

Create a box that is exactly 200px wide and 100px tall.

Look at the dotted outline - that's your target size!
2

Stack 'Em

Medium

Use Flexbox to arrange these 3 boxes vertically (column).

1
2
3
First set display to "flex", then choose the right direction!
3

Grid Master

Hard

Create a 2x2 grid layout using CSS Grid.

A
B
C
D
Set display to "grid", then define 2 columns with "1fr 1fr"!

Amazing Work!

You've completed all the challenges! You now understand the basics of HTML element sizing, Flexbox, and CSS Grid.

Next Steps

Keep learning with these free resources

MDN Web Docs

The gold standard for web documentation

freeCodeCamp

Free interactive coding lessons

Flexbox Guide

Complete visual guide to Flexbox

CSS Grid Guide

Complete visual guide to CSS Grid

Essential Free Tools

VS Code Code editor
DevTools Built into browsers
Git Version control
GitHub Code hosting