Below the Fold

A designer’s path to creative technologist. Thirty days, ten minutes each, on how software actually gets made.

A tree inside the window A browser window holding a tree of connected nodes, the page as the browser sees it, with one node in red.

The browser

After today, you can explain what HTML, CSS, and JavaScript each do on a page, and why the inspector shows something different from the file the server sent.

Dip your toes 1 min

Every web page is built from three languages, each with one job. HTML says what each part is: a heading, an image, a button. CSS says how each part looks, from color to spacing. JavaScript makes the page respond, like the preview that plays when you hover over a YouTube video card. The browser turns the HTML into a live tree of parts, and JavaScript keeps changing that tree after the page loads. That’s why the page you see can differ from the file the server sent. It’s why a video card can appear blank, then fill in late. HTML is also why a button in your design needs to be built as a real button, so screen readers announce it.

The full lesson 10 min

Why this exists

Look at one video card on YouTube’s home page. It has a thumbnail, a title, a channel name, and a view count. Hover over it and a preview starts playing. Click the three-dot menu and a list of actions opens.

The same card works in Chrome, Safari, and Firefox, on a phone and a desktop. It even works through a screen reader, for someone who can’t see it.

The web gets there by splitting a page into three jobs, each with its own language. One says what each part is. One says how it looks. One says what it does. Each can change without rewriting the other two.

That split matters to more than engineers. A screen reader relies mostly on what each part is. A redesign can change every color and margin without touching a word of content. And if a script fails on a slow train, a page whose HTML carries the content still shows something useful through its structure and styling. Separating the jobs is what lets one page serve all those readers at once.

It also lets different people own different parts. A design system team can ship new styles while a feature team changes behavior in the same week.

What it is

A web browser is a program that downloads a page’s files and turns them into something you can see and use. It asks for the HTML file first. Inside it, the browser finds references to CSS and JavaScript files, and it fetches those too. The files come in three languages.

HTML (HyperText Markup Language) describes what each part of a page is. It wraps content in tags that name its role: a heading, a paragraph, a link, an image, a button. Here’s a simplified version of the HTML for one video card:

<article class="video-card">
  <a href="/watch?v=abc123">
    <img src="thumbnail.jpg" alt="How bridges stay up">
  </a>
  <h3>How bridges stay up</h3>
  <p class="channel">Bridge Talk</p>
  <p class="meta">1.2M views, 3 days ago</p>
</article>

Each pair of tags makes an element. The h3 marks a heading, which is a statement about meaning, not about size. The class names are labels the team chose so other code can find these elements. The alt text describes the image for anyone who can’t see it.

CSS (Cascading Style Sheets) decides how each part looks. A CSS rule picks elements, often by those class names, and sets properties like color, size, spacing, and layout. “Cascading” describes what happens when several rules apply to the same element: the browser follows a fixed order to decide which one wins. That order is why a style sometimes refuses to change until an engineer finds the rule overriding it.

A rule like .channel { color: #606060; } reads as a sentence. Find every element labeled channel and make its text this shade of gray. One rule can style every channel name on the page, so changing it once changes them all. That’s the reason CSS lives apart from the HTML: the look of a thousand elements can change in one place.

JavaScript makes the page behave. Day 2 introduced it as the language of the browser. Its job on a page is to respond to events, like a click or a hover, and change the page while it’s open. The hover preview on a YouTube card is JavaScript. So is the menu that opens from the three dots.

One button, three languagesA Subscribe button at the top splits into three boxes. Structure, in HTML, is a button element containing the word Subscribe. Style, in CSS, sets the font weight and rounded corners. Behavior, in JavaScript, subscribes you when clicked and changes the label.SubscribeStructureStyleBehaviorHTMLCSSJavaScript<button>Subscribe</button>font-weight: 600;border-radius: 18px;On click, subscribeand change the label
Figure 1. YouTube’s Subscribe button, described three ways: what it is, how it looks, and what it does. Look at the HTML column. Without it, there’s nothing for the other two to style or control.

The browser doesn’t work from the HTML file directly. It reads the file once and builds the DOM (Document Object Model), a tree of elements it keeps in memory while the page is open. Each element in the HTML becomes a node in the tree, and nested elements become its children.

CSS styles the nodes in that tree. JavaScript reads and changes them. When you look at a page, you’re looking at the DOM, drawn on screen.

That’s also how a page changes without reloading. When you click Subscribe, JavaScript changes the button’s node in the DOM, and the browser redraws only that part of the screen. A new comment appearing, a like count going up, a menu opening: each one is JavaScript adding, removing, or editing nodes in the tree.

The video card’s DOM treeA tree with an article node at the top. Its children are a link containing an image, a heading for the video title, and a paragraph for the channel name. The heading is selected, and a panel to the right lists its font size and font weight.articleaimgh3pThe whole cardLink to the videoThumbnailVideo titleChannel nameIn the inspectorh3font-size: 16px;font-weight: 500;
Figure 2. The DOM for the video card, as a tree of nodes, with one node selected in the browser’s inspector. Look at the title node. Selecting it in the inspector shows the exact styles the browser applied to it.

Every modern browser lets you see this tree. Right-click anything on a page and choose Inspect, and the developer tools open with that element selected. Safari calls it Inspect Element, and shows it only after you turn on “Show features for web developers” in its Advanced settings.

The left side shows the DOM. The right side shows every CSS rule that applies to the selected node, including the ones that lost the cascade, crossed out. A Computed view next to it lists the final values the browser settled on. When a design and a build disagree, that list is where the argument ends.

How it shows up in your work

Design review gets more precise once you use the inspector. Instead of guessing whether a title is 16 or 18 pixels, select it and read the number. Instead of eyeballing spacing, hover over an element and the browser outlines its padding and margins. Figma’s Dev Mode has an Inspect panel too, but it shows the values the design intends. The browser’s inspector shows the computed values the page actually uses, and design review checks the gap between them.

You can even edit values in place to try a change, like more space under a heading. The edit only lives in your copy of the DOM and disappears when you reload, so nothing you do there can break the real page. The same tools can also show the page at phone sizes, so you can check a layout without reaching for a device.

Handoffs go more smoothly with design tokens: named values for color, type, and spacing that the design and the code share. In CSS, a token often becomes a custom property, a named value defined once and used in many rules. When the names in your design file match the names in the code, a change in one place can flow through to every screen.

From design token to CSSA token named text secondary in the design file is copied into the CSS as a custom property with a gray value. Three parts of the video card use it: the channel name, the view count, and the upload date.In the design fileIn the CSSOften copied by handtext-secondary--text-secondary:#606060Channel nameView countUpload date
Figure 3. A design token travels from the design file into the CSS, where every component that needs it refers to it by name. Look at the custom property in the middle. Change its value once, and every place that uses it changes too.

The dashed line in Figure 3 is the weak point. On many teams, someone copies token values from the design file into the code by hand, and the two drift apart over months. Ask how your tokens get from one to the other. If the answer is “by hand,” a mismatch you spot in review may be a token problem, not a one-off bug.

Accessibility reviews depend on the HTML, too. A screen reader announces elements by what the HTML says they are, not by how they look. A button element gets announced as a button, can be reached with the Tab key, and works with Enter and Space. A div, a generic box, styled to look like a button gets none of that unless an engineer adds it back by hand.

When a design calls something a button, ask whether it’s built as one. It’s a small question, and it catches one of the most common accessibility bugs on the web.

Images need the same care, because the alt text is part of the design. If the design doesn’t say what it should be, an engineer will guess, or leave it empty.

The one thing people get wrong

“What you see is the file the server sent.” After all, the server sends a file and the browser shows it. But the screen shows the DOM, and JavaScript keeps changing the DOM after the file arrives. On many modern sites, the file is mostly a script and an empty frame, a div labeled app. JavaScript builds nearly everything you see inside it.

The file versus the live DOMOn the left, an HTML file contains html, body, an empty div named app, and a script. An arrow labeled JavaScript runs points to the right, where the live DOM in the browser’s memory has html, body, and the app div, now holding a header and many video cards, with the script still in place below it.The file the server sentThe live DOM, in memoryJavaScript runshtmlbodydiv#appscript app.jshtmlbodydiv#appheadervideo cardvideo cardscript app.jsEmptyand many more
Figure 4. A video page built by JavaScript: the HTML file as sent, and the live DOM a moment after its JavaScript runs. Look at the highlighted nodes. None of them are in the file. JavaScript added them after the page loaded.

You can see the difference yourself. In most browsers, View Page Source shows the file exactly as the server sent it. Inspect shows the DOM as it is right now. On a page built mostly by JavaScript, the two can look like different pages. The source might have a few dozen lines, while the inspector shows thousands of nodes.

This explains a whole class of bugs. If the data for a card arrives late, the card can appear blank, then fill in, then shift the layout below it. If the script fails, the page can stay empty even though the server sent a file without errors. A bug report that says “the page is blank” leads to very different fixes depending on whether the file or the script went wrong.

Why build pages this way at all? Because much of what you see is different for every person. Two people opening YouTube’s home page see different videos, picked for each of them. So the frame can be the same file for everyone, and JavaScript fills it with data fetched for the person looking. The frame can also be stored close to users and sent fast, while the personal part arrives a moment later.

It also matters for design. A layout that looks right in its final state can jump around while JavaScript builds it. Users see that in-between moment on every slow connection. Ask engineers what the page looks like before the scripts finish. Day 11 covers where and when pages get built.

Ask an engineer this

“When I inspect this screen, which parts came in the HTML file and which did JavaScript add afterward?”

Bring this up while you both have the developer tools open on a screen you designed. The engineer can point to the empty frame in the page source and the nodes that scripts add later. Pay attention to which parts depend on data arriving from the server, because those are the parts that can appear late, blank, or broken. Then ask what users see in the moment before those parts arrive. That shows you which loading and empty states your design needs and which ones nobody has drawn yet.

Terms from today

HTML
HyperText Markup Language, the language that describes what each part of a page is, such as a heading, a link, an image, or a button.
CSS
Cascading Style Sheets, the language of rules that decide how each part of a page looks, from color and type to layout.
JavaScript
The programming language browsers run to make a page behave, responding to clicks and changing the page while it’s open.
DOM
The Document Object Model, the live tree of elements a browser builds from a page’s HTML and keeps in memory while the page is open.
Next

Day 9: Request and response

The client asks, the server answers. URLs, HTTP in plain terms, what a 404 and a 500 are.

8

The browser

All 30 days