Boss lesson · Unit 02
The first paint
One page, four files: what must arrive before pixels, and the cheapest way to paint sooner
What you practise
- What must arrive before the first paint, render-blocking resources, and the cheapest change that paints sooner
Try a question from this lesson
Pick one
One page and the moment each of its files arrives. Which file could arrive far later without delaying the moment the heading appears?
<head>
<link rel="stylesheet" href="site.css">
<script src="app.js"></script>
</head>
<body>
<h1>Sale</h1>
<img src="photo.jpg">
</body>
arrives at (ms)
index.html 100
site.css 300
app.js 600 then runs 50 ms
photo.jpg 900Correct answer
photo.jpg
Why
An image blocks nothing: the page is painted with an empty space and the picture fills in later. The heading needs the HTML it is written in, the CSS that styles it, and the script the parser is stuck behind.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Render-blocking
To paint, the browser needs the DOM for the content and all the CSS from the head.
A stylesheet blocks painting: no pixels until it is in. A plain script blocks the parser: nothing below it exists yet. The files a first paint must wait for are the critical path.
11 more exercises in the app
- 4× type the answer
- 2× true or false
- 2× multiple choice
- 1× fill the blanks
- 1× order the lines
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.