No history yet

Introduction to Web Rendering

How a Web Page Comes to Life

When you type a web address into your browser and hit Enter, a complex process kicks off to turn code into the interactive page you see. This process is called rendering. Your browser acts like a skilled construction manager, taking raw materials and building a complete, functional webpage from them.

The three core materials for any website are HTML, CSS, and JavaScript. Each has a distinct job:

  • HTML (HyperText Markup Language): Provides the basic structure, like the foundation and frame of a house. It defines the elements on the page, such as headings, paragraphs, and images.
  • CSS (Cascading Style Sheets): Adds the style, like the paint, furniture, and decorations. It controls colors, fonts, and the layout of the HTML elements.
  • JavaScript (JS): Makes the page interactive, like the plumbing and electricity. It handles things that happen after the page first loads, like animations, form submissions, and data updates.

These three technologies work together, but where and when they are assembled can vary dramatically. This is where rendering strategies come into play.

Where the Page Gets Built

The main question in web rendering is: who does the heavy lifting? Is it the server where the website's files are stored, or is it your local browser? The answer determines the rendering strategy.

The rendering strategy affects how quickly a page loads, how search engines see it, and how up-to-date its content is.

Let's explore the three most common approaches.

Client-Side Rendering (CSR)

With Client-Side Rendering, your browser receives a nearly empty HTML file along with a large JavaScript file. Think of it like getting a flat-pack furniture kit.

Your browser (the "client") has to read the instructions (the JavaScript) and assemble the entire webpage from scratch. While this is happening, you might see a blank screen or a loading spinner. Once the JavaScript is downloaded and run, the page appears and becomes interactive.

In CSR, the browser builds the page. This is common for highly interactive web applications like social media dashboards or photo editors.

Lesson image

Server-Side Rendering (SSR)

With Server-Side Rendering, the server does the assembly work. When you request a page, the server generates the full HTML for it and sends this completed page to your browser. It’s like ordering pre-assembled furniture.

The page appears very quickly because the browser just has to display the HTML it received. Afterward, a smaller amount of JavaScript loads in the background to handle interactivity, a process called "hydration."

In SSR, the server builds the page for each user request. This is great for content that changes often and needs to be SEO-friendly, like e-commerce sites or news articles.

Static Site Generation (SSG)

Static Site Generation takes the SSR idea one step further. Instead of building the page when a user requests it, the server builds every page ahead of time, during a "build step." The result is a collection of ready-to-go HTML files.

When you visit the site, the server just sends you the pre-built file. This is like buying furniture directly off the showroom floor—it's already built and ready for immediate delivery. This method is incredibly fast and secure because there's no on-the-fly page generation.

In SSG, the pages are pre-built before anyone visits. This is ideal for content that doesn't change often, such as blogs, marketing pages, or documentation.

StrategyHow It WorksBest ForProCon
CSR (Client-Side)Browser builds the page using JavaScript.Highly interactive web apps (dashboards, editors).Rich user interactions.Slow initial load, can be poor for SEO.
SSR (Server-Side)Server builds page for each request.Dynamic content, e-commerce, news sites.Fast initial load, SEO-friendly.Higher server load.
SSG (Static)All pages are built ahead of time.Content that rarely changes (blogs, portfolios).Extremely fast and secure.Content can become stale until next build.

Understanding these core strategies is the first step to building modern, efficient websites. Frameworks like Next.js are powerful because they allow developers to choose the best rendering strategy for each page of an application, blending the strengths of all three approaches.

Quiz Questions 1/4

Which technology is primarily responsible for a webpage's structure and content, such as defining headings, paragraphs, and images?

Quiz Questions 2/4

If a website is delivered to your browser like a flat-pack furniture kit that you must assemble yourself using a large instruction manual, which rendering strategy does this represent?