
Mini lesson 6 of 30 · Make your website useful
Inspect the supplied before page
Who is this for?
People who want lighter website images without blurry or distorted results. The image and export tool are supplied; a coding assistant can connect the files for you.
A small picture on screen can still download a large file.
Purpose of this lesson
- Export two useful sizes from a supplied image.
- Connect them without distorting the picture.
- Check the file actually loaded and compare like-for-like conditions.
Explanation, worked example and practice
Before you start
A browser, the supplied workshop and a coding assistant for the page edit. No personal photo or existing website is needed. Use the supplied measurement sheet to keep the comparison fair. Worked answers are illustrative examples, not completed tests on your account. Replace their sample observations with your own results, or identify the step that is still blocked.
Check your starting skills
These are useful skills, not locked course requirements. If you can already do them, start this lesson; otherwise open the linked preparation. The supplied starter files mean you do not need an existing personal website.
- How to build your first personal website
Create an introduction, project section and contact route from a supplied starter.
Estimated time: 20–32 min
Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Results depend on image content, viewport, pixel density and caching. File-size reduction is not automatically an equal reduction in total page load time.
Understand the idea
Open before/index.html and look at the supplied picture. Use measurements.txt with your assistant to record the original file and its size. Keep the page’s visible purpose as your comparison.
Separate displayed size from downloaded file size. A page can shrink a large image visually without reducing what the visitor downloads.
A concrete example
The supplied page references photo-full.webp even when the picture looks small on screen. Compare the file information or browser resource entry, not the apparent width of the picture.
Use the supplied original image and export tool. Help connect the 480px and 960px exports to the after page while preserving aspect ratio and alternative text. Keep the visible layout comparable to before. Show me how to identify the actual downloaded image and compare bytes under the same cache conditions. Handle the page code for me; explain what I need to observe.Files for this step

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
What file did the before page use, and what size did you actually observe?
Show a worked solution
Example file-inspection record: before/index.html refers to photo-full.webp. The supplied original file is 706,380 bytes on disk. That is a file-size observation, not a measured browser transfer; displaying it at 300 pixels would not change those file bytes.
What a sound answer includes
- Identifies the actual supplied image file and where its size was read.
- Distinguishes file/download bytes from the width of the displayed picture.
How it works (optional)
Measure what the browser downloads
A small display does not necessarily mean a small image request.
Open the before page through a local server. In developer tools, inspect the image request at a narrow viewport and record its URL and transferred bytes. Keep the cache setting consistent when comparing versions.
CSS can display a large original at a small width while the browser still downloads the original bytes. Changing the displayed width alone does not create a smaller file.
Worked example
The before page requests photo-full.webp even when its displayed width is only a few hundred pixels. Record this observation before trying the after page.
Extra implementation exercise
You set an image’s CSS width to 300px. Does that prove the browser downloaded a 300px file?
Show a worked solution
No. Inspect the selected resource. CSS sizing does not by itself change the image file at that URL.
- Separates displayed size from resource size.
- Checks the requested URL and actual bytes.

Step 1 · How to make website images load faster
Export the supplied image
Use the ready tool rather than finding your own photo.
Explanation, worked example and practice
Understand the idea
Open tools/export.html from the lesson and choose the supplied image. Export one 480-pixel and one 960-pixel version. Keep the tool’s actual file extension, including a PNG fallback if used.
Open the exported images and compare the same subject. Check that the shape is preserved and detail is sufficient at the intended display size.
A concrete example
Open the two outputs, not just their download names. The check is “480 pixels wide, same proportions, useful detail,” not merely “a file called photo-480 exists.”
Files for this step

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
Which two files did you export, and did their dimensions and appearance match the intended sizes?
Show a worked solution
Example export record: I exported photo-480.webp at 480 pixels wide and photo-960.webp at 960 pixels wide. Both preserved the shape of the original model-house image. I compared detail at the intended display size. If the tool produced PNG instead, I would record and keep that real extension.
What a sound answer includes
- Names the two actual exports and verifies their 480/960-pixel widths.
- Checks proportions/clarity and records any actual image-format fallback.
How it works (optional)
Create useful image sizes
Export sizes that match the places where your image will actually appear.
The supplied after folder includes 480px, 960px and full-width versions of the same illustration. Compare their actual file sizes and look for lost detail at the intended display size.
Open tools/export.html and choose Use supplied image to load before/photo-full.webp. Export at 480px, then 960px. The tool runs in your browser and downloads the results; it does not upload the image. Keep the supplied original for further exports. If the download ends in .png, your browser used PNG. Keep that extension and update the HTML to the actual downloaded filenames; do not rename PNG bytes to .webp.
Worked example
A 960px resource can be appropriate for an image displayed near 480 CSS pixels on a 2× screen. That is a starting estimate, not a universal rule for every layout.
Extra implementation exercise
Why might a high-density phone choose the 960px image rather than the 480px image?
Show a worked solution
Its screen may use more than one device pixel for each CSS pixel. Compare sharpness and transferred bytes under the same device conditions.
- Recognizes that device pixel ratio affects needed pixels.
- Evaluates sharpness at the actual displayed size.

Step 2 · How to make website images load faster
Connect the exported files
Give the assistant the assets and a visible acceptance check.
Explanation, worked example and practice
Understand the idea
Ask your assistant to connect the two exports in after/index.html. Tell it how wide the image appears in the page and ask it to preserve the layout and useful image description.
Open a phone and wide view. With the assistant’s help, inspect which image the browser actually chose rather than assuming it used the smaller one.
A concrete example
At about 390 pixels the image occupies less space than it does on desktop, but a dense screen may still need the larger source. Have the assistant show the browser’s actual selected resource for your current view.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
Which resource did the updated page load in each view you checked?
Show a worked solution
Example browser record: In a 390-pixel-wide, 1×-density view the resource check showed photo-480.webp; in a wide 1× view it showed photo-960.webp. Both looked undistorted. These are illustrative choices, not a guarantee: screen density and a previously loaded larger image can change the browser’s selection.
What a sound answer includes
- Records the resource actually selected in each named viewport/device-density context.
- Checks the resulting appearance and investigates any mismatch instead of assuming the smallest source was used.
How it works (optional)
Tell the browser about the alternatives
srcset lists available resources; sizes describes the image’s layout width.
Read the image element in after/index.html. Each width descriptor states the actual pixel width of its file. The sizes expression approximates this page’s content width, not the raw screen width.
Keep width and height attributes to reserve a matching aspect ratio. The CSS remains flexible. An accurate alt description serves people who cannot see the image; it is not a place for a list of search keywords.
The image element's width/height attributes describe its aspect ratio and reserve layout space. They do not claim that every srcset file is 1672px wide. The 480w and 960w descriptors must match those files' actual pixel widths; device pixel ratio and the sizes layout estimate help the browser choose among them.
For this supplied layout, main has 28px padding on each side, so 56px is subtracted on narrow screens. Its 850px maximum outer width minus that padding gives the 794px content estimate. Calculate these values from your own CSS if you change the layout.
Worked example
The full source is available in the after file. A srcset descriptor that claims 960w for a 480px image would misdescribe the resource.
<img src="photo-960.webp"
srcset="photo-480.webp 480w, photo-960.webp 960w"
sizes="(max-width:700px) calc(100vw - 56px), 794px"
width="1672" height="941" alt="Two people building a model house">Extra implementation exercise
What is wrong if sizes says 100vw but the image sits inside a much narrower content column?
Show a worked solution
The browser may select a larger resource than the layout needs. Describe the real image width and inspect currentSrc and the network request again.
- Identifies inaccurate layout information.
- Adjusts sizes to the actual column and retests resource selection.

Step 3 · How to make website images load faster
Compare under the same conditions
Do not compare a fresh download with a cached one.
Explanation, worked example and practice
Understand the idea
Use the same page, view and cache conditions for before and after. Let the assistant guide the browser measurement steps; record file bytes separately from timing.
A smaller measured download can be evidence for this image change. Timing can vary, so do not call one inconsistent run a proven site-wide speedup.
A concrete example
Do not compare a fresh original download with an after image already in cache. Record the selected file and cache condition on both sides before interpreting the numbers.
Files for this step
Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
Try it yourself
How did you keep the comparison fair, and what changed in the measured resource?
Show a worked solution
Example comparison record: Same wide view, same device density and a fresh load for both pages. Before used the 706,380-byte original; after selected the supplied 174,346-byte 960-pixel reference. Those file sizes explain a smaller image payload. I would record actual transferred bytes separately and repeat timing before drawing a performance conclusion.
What a sound answer includes
- Matches viewport, pixel density, layout and cache conditions in the comparison.
- Reports resource-byte changes separately from variable timing or whole-site speed claims.
How it works (optional)
Compare under the same conditions
Verify the selected image, file size and appearance together.
Compare the before and after pages with the same viewport, device pixel ratio and cache policy. Inspect currentSrc or the Network panel to learn which candidate the browser selected.
Resize the viewport and repeat. A browser may retain an already downloaded larger resource; start a fresh test when needed. Judge the image at its displayed size and record artifacts or blur, not just a smaller byte count.
Worked example
A sound record says “390px, 1×, cache disabled, resource X, Y bytes”. A single load-time number from different network conditions is not a controlled comparison.
Extra implementation exercise
Before was tested with a cold cache and after with a warm cache. Is the timing difference reliable evidence for your change?
Show a worked solution
No. Repeat with equivalent cache and network conditions. Compare actual resource selection and bytes as well as timing.
- Identifies the changed cache condition.
- Repeats the measurement with a consistent setup.

Step 4 · How to make website images load faster
Finish the image improvement
Show a lighter download that still looks right.
Explanation, worked example and practice
Understand the idea
Complete the 480/960 exports and connection, then repeat the file-choice and appearance checks. Keep the supplied original available for comparison and save the updated page.
Check clarity, aspect ratio and actual resource selection. Record what was observed; the reference files show a comparison, not your browser’s result.
A concrete example
A complete result includes both sides: which smaller resource the browser loaded and whether the picture still does its job. A small file that is stretched or unreadable is not a finished improvement.
Files for this step

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.
- before/photo-full.webpDownload this file
- tools/export.htmlDownload this file
- after/index.htmlDownload this file
- after/photo-480.webpDownload this file
- after/photo-960.webpDownload this file
- measurements.txtDownload this file
- worksheet.htmlDownload this file
- reference/assignment-walkthrough.txtDownload this file
Try it yourself
Provide the exported files, updated page and your actual comparison record.
What to produce: Your two exported images, updated page and a fair before/after download/quality record.
Show a worked solution
Example handoff: My two 480/960-pixel exports are connected to after/index.html, and the original remains available for comparison. The model-house image keeps its proportions and useful description. My record names the resource loaded at each tested view and the matched cache conditions; unmeasured timing and untested densities remain open checks.
What a sound answer includes
- Provides actual exports and the updated page with preserved proportions and useful alternative text.
- Includes selected-resource and fair before/after observations with quality and coverage limits.
How it works (optional)
Your assignment: optimize the supplied website image
Preserve useful visual detail while delivering an appropriate resource.
Start with before/photo-full.webp, the illustration supplied with this lesson. Use tools/export.html to create 480px and 960px versions. Save them in after/ and update after/index.html; keep the image content, layout and alt text unchanged.
Record the before/after request and a visual check. If the browser chooses a larger candidate for a high-density screen, explain that result instead of forcing the smallest file.
Worked example
Your report should name the image, conditions, selected resource and quality trade-off. Do not replace a meaningful photo with an unrelated tiny graphic just to improve the measurement.
The full approach is in reference/assignment-walkthrough.txt. Use the supplied before/after pages and fill measurements.txt with your observed results. You do not need to bring an image or build a website first.
Extra implementation exercise
Use before/photo-full.webp to create 480px and 960px images, connect them in after/index.html and demonstrate which resource the browser requests.
Show a worked solution
At a 390px viewport and deviceScaleFactor=1, open a fresh before page with consistent cache conditions and record currentSrc and actual image bytes. Do not infer the downloaded width from the CSS box.
In the after page the supplied 480w candidate should be a suitable small-screen option, but record the browser's actual choice. At higher pixel density, the 960w candidate may be reasonable. The width/height HTML attributes preserve aspect ratio; each srcset descriptor describes its own file.
Load before/photo-full.webp in tools/export.html, export at 480px and 960px, and save the files in after/. Set each srcset width descriptor to its actual exported width. Repeat the same viewport, pixel density and cache conditions, and record currentSrc, resource dimensions, bytes and visible detail in measurements.txt. Use observed numbers, not invented savings.
- Descriptors match actual widths and the layout remains stable.
- A controlled comparison shows the selected resources and acceptable visual quality.
Was this lesson useful?
Leave a like, or share it with someone who could use it.