Course contentsShow
← Web Development
Lesson 11 of 2,9821. The Web Platform FoundationFree lesson

Static vs Dynamic Content

Distinguishing between pre-built files served as-is and content generated on-demand by server logic.

Static vs Dynamic Content

What you'll learn: You'll discover the difference between web pages that are pre-made files and those created fresh for each visitor.

When a web server receives an HTTP request, it can respond in two fundamentally different ways: by sending a file that already exists on disk, or by running some logic to create the response on the spot.

Static Content

Static content is like a printed menu at a restaurant. The menu was created once, and every customer sees the exact same thing. When you request a static web page, the server simply locates the pre-written HTML file (along with any images, CSS, or JavaScript files) and sends it back to you unchanged. The file was there before you asked for it, and it'll be there after.

Examples: A company's "About Us" page, a blog post from last year, an image file, a PDF download.

Dynamic Content

Dynamic content is like ordering a custom sandwich. The ingredients exist, but the sandwich is assembled specifically for you when you order it. When you request a dynamic page, the server runs a program that might check a database, look at who you are, consider the time of day, or process form data you submitted—then it builds an HTML response on the fly.

Examples: Your personalized social media feed, search results, a shopping cart total, weather forecasts.

The key difference isn't what the content looks like in your browser—it's when and how it was created. Static content exists as files waiting to be served. Dynamic content is generated by server logic each time it's requested.

Key Takeaway: Static content is pre-built and served as-is from files; dynamic content is created on-demand by the server running code that tailors the response to each request.