thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

04.05 · Lists, links and images / Watch · 5 min

Use an actual image URL

Distinguish an image file URL from the page where you discovered the image.

Activity 5 of 7 in Lists, links and images

Rob illustrates distinguish an image file URL from the page where you discovered the image.
Rob’s comic strip · Lists, links and images

ORIGINAL WALKTHROUGH · 4:40

Watch with Rob.

Pause whenever you want to try a change. You can return to the lesson at any time.

LEARN WITH THE CODE ZONE

Unlock this video walkthrough

Written lessons and coding practice are free. Video walkthroughs are included with a paid Code Zone membership or an active free trial.

Have a Code Zone website account? Use your learning account’s email to get a six-digit sign-in code, or use your existing website password.

Need a website account? Paid Skool members and active trial members can use the email from their membership questions to request a sign-in code. No invite link or Skool password needed.

Close this window to keep practicing. After signing in, you’ll return to this lesson.

Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.

Starter source code for VS Code

Copy the source below or download the file to follow along in VS Code.

The download includes a lesson link in each file and a README so you can find your way back.

index.html
index.htmlhtml · example
<!--
Follow Rob’s original use an actual image url walkthrough. Pause, make one change and inspect the page. Use the attached lesson’s task and resource links. This separate workspace is for your own code-along experiments.
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Image Tags</title>
  </head>
  <body>
    <h1>Cat image</h1>
    <img
      src="https://images.unsplash.com/photo-1592194996308-7b43878e84a6?auto=format&fit=crop&w=600&q=80"
      alt="A cat indoors"
      width="400"
    />
  </body>
</html>

Choose the file, then describe it

Rob’s original example uses a cat image hosted at images.unsplash.com. A photo’s webpage URL and the actual image URL are different resources: img needs the image resource.

If you download a photo into your own project, use its local relative path instead. Check the image provider’s current terms for the photo you select.

Choose the file, then describe it
index.htmlhtml · example
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Image Tags</title>
  </head>
  <body>
    <h1>Cat image</h1>
    <img
      src="https://images.unsplash.com/photo-1592194996308-7b43878e84a6?auto=format&fit=crop&w=600&q=80"
      alt="A cat indoors"
      width="400"
    />
  </body>
</html>

Avoid stretching a large source

Use a suitable image size and keep its proportions. The course preview supplies basic max-width support; that supporting preview style is not a CSS assignment.

Try a meaningful alt description and inspect the loaded picture, rather than choosing an alt value based only on the filename.

YOUR TURN

Use an actual image URL — explore

Load an example into this editor, make one change and Run code to inspect the page. This exploration has no pass/fail grade. Save a private account draft or share an independent help snapshot when signed in.

Load an example, edit it and run it. Word wrap is enabled.

Replace your editor code?

Your current work will be replaced. Choose Cancel to keep it.

ONE STEP FORWARD

Try a meaningful alt description and inspect the loaded picture, rather than choosing an alt value based only on the filename.