Content · Web Development · HTML

HTML Linking Directly to Images, PDFs, and Files

You can link directly to an image, a PDF, or another file just as you link to an HTML page. The destination's file type affects how the browser handles it.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

You can link directly to an image, a PDF, or another file just as you link to an HTML page. The destination's file type affects how the browser handles it. The important question is always where the link leads and whether the person reading the page can predict it.

What You Need to Know


Explain the file format in the visible label, especially for large downloads. A PDF may open in the browser instead of downloading unless download behavior is explicitly requested and allowed.

Links are the pathways through a website. The words on a link should help someone choose where to go before clicking it.

Example: See It in Action


Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<ul>
    <li><a href="files/handout.pdf">Open the PDF handout</a>
    </li>
    <li><a href="images/poster.png">View the poster</a>
    </li>
</ul>

Let’s Understand the Example


  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • Li is one item inside a list. Keep each item inside its parent list.
  • Ul groups items where the order does not matter.
  • Href contains the destination of a link. A value starting with # points to an id on the same page.

The first example link points to files/handout.pdf. Check whether that destination exists relative to the document. A link changes where readers go; it does not perform an action such as saving a form.

What Should You See?


You should see a link named “Open the PDF handout”. Selecting it leads to files/handout.pdf when that destination exists. Try it with the mouse and the keyboard.

Imagine this link is read out of context. Would its text still explain the destination? Rename unclear links before trying to make them look nicer with CSS.

Try It Yourself


  1. Give a PDF link a label that says what the document contains.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Writing View file for every resource without mentioning its type or purpose.
  • Avoid dead links, empty href values and clickable-looking text without a real destination.

Key Takeaways


  • You can link directly to an image, a PDF, or another file just as you link to an HTML page.
  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • Explain the file format in the visible label, especially for large downloads. A PDF may open in the browser instead of downloading unless download behavior is explicitly requested and allowed.
Share this resourceSend this page to someone who may find it useful.