An image can do more than add color to a page—it can also lead visitors somewhere useful. Wrap an <img> element in an <a> element, set the link with href, and use target="_blank" to open it in a new tab. Add descriptive alt text and consider rel="noopener" for safer browsing.

Multiple Choice

Which HTML element is used to create an image link that opens a new page?

The appropriate HTML element used to create an image link that opens a new page is the anchor element, which is represented by the "a" tag. This tag is specifically designed to define hyperlinks, allowing users to click on it to navigate to another page or resource. To create an image link, you would nest an "img" element (which displays the image) inside the "a" element. This nestling means that when a user clicks on the image, they are directed to the link specified in the "href" attribute of the "a" tag. Furthermore, to ensure that the link opens in a new page or tab, you can include the "target" attribute set to "_blank". For instance, the correct syntax to accomplish this would look like: ```html <a href="http://example.com" target="_blank"> <img src="image.jpg" alt="Description of image"> </a> ``` In this code, the image serves as a clickable link, and the page or site will open in a new tab when the image is clicked. The other options—img, link, and picture—serve different purposes within HTML and do not facilitate the creation of a link that can open a new page. The

An image can do more than decorate a page. Wrapped in a link, it becomes a clear, clickable route to another page, product, article, or resource. In HTML, the <a> element creates that route, while the <img> element displays the image. Put the image inside the link, and the whole image becomes clickable.

Here’s the basic pattern:


<a href="https://example.com" target="_blank" rel="noopener">

<img src="images/landscape.jpg" alt="A mountain lake at sunrise">

</a>

The href attribute tells the browser where to go. The target="_blank" value asks it to open the destination in a new tab or window. And rel="noopener" adds a small security safeguard, especially useful when a link opens another site.

That’s the simple version. To use image links well, it helps to understand what each part does—and how a little care with accessibility, styling, and link behavior can make the result much better.

The anchor sets the destination

The <a> element, often called an anchor, defines a hyperlink. It can link to another website, a page on the same site, a file, or a specific spot within a page. Its href attribute holds the destination:


<a href="/articles/accessibility.html">Read the accessibility guide</a>

When the linked content is an image, the anchor still does the same job. The image is simply the content people click.


<a href="/gallery/coast.html">

<img src="/images/coast-thumbnail.jpg" alt="View the coastal photo gallery">

</a>

The <img> element alone displays an image; it doesn’t create a link. Likewise, <picture> can help a browser choose among image sources, but it isn’t a hyperlink. The <link> element serves a different role, often connecting a document to a stylesheet or another resource. These elements can work together, but the anchor is what makes navigation happen.

Think of the anchor as a doorway and the image as the sign on it. A striking sign might draw attention, but the doorway’s destination still comes from href.

What “opens in a new page” means

People often say a link opens in a “new page,” but browsers generally open it in a new tab when the anchor includes target="_blank". Browser settings can affect the exact result, so the site can request a new tab or window but can’t dictate every detail.


<a href="https://example.com" target="_blank" rel="noopener">

<img src="images/brand-mark.png" alt="Visit Example">

</a>

Use this behavior thoughtfully. Opening a link in a new tab can be helpful when someone is moving to an external resource and may want to keep the original page handy. But unexpected tabs can also feel jarring, especially for people using screen readers or other assistive technology. For many links, letting the browser open the destination in the current tab is the simplest and most familiar choice.

If a new tab is important, tell people. One option is to include the information in the link’s accessible name:


<a href="https://example.com" target="_blank" rel="noopener">

<img

src="images/brand-mark.png"

alt="Visit Example (opens in a new tab)"

>

</a>

The wording doesn’t need to be long. It just needs to make the behavior clear.

Alt text carries the meaning

The alt attribute gives an image a text alternative. When an image is the only content inside a link, that alternative also helps describe the link’s purpose. This makes alt text more than a caption: it can tell someone where the link leads.

For example:


<a href="/products/field-notes.html">

<img

src="/images/field-notes-cover.jpg"

alt="Explore the Field Notes journal"

>

</a>

This communicates an action and a destination. By contrast, alt text such as “blue notebook on desk” describes only what the image looks like. That description could be useful in an article about the photo, but it may not explain why the image is clickable.

If nearby text already states the link’s purpose, the image may not need to repeat it. In that case, use an empty alt value:


<a href="/products/field-notes.html">

<img src="/images/field-notes-cover.jpg" alt="">

Shop Field Notes

</a>

This avoids having a screen reader announce duplicate information. The right choice depends on the surrounding content; a few words can change what the image contributes.

CSS can clarify the interaction

A clickable image should look clickable. Some sites use a border, a caption, a hover effect, or a subtle change in brightness. Keep the effect restrained enough that the image remains easy to see.


.image-link {

display: inline-block;

border-radius: 0.5rem;

overflow: hidden;

}

.image-link img {

display: block;

max-width: 100%;

height: auto;

transition: opacity 160ms ease;

}

.image-link:hover img {

opacity: 0.82;

}

.image-link:focus-visible {

outline: 3px solid #2457d6;

outline-offset: 4px;

}

The :hover style gives mouse users a visual cue. But not everyone uses a mouse, so the :focus-visible rule matters too. It shows a clear outline when someone reaches the link with a keyboard. Removing focus outlines without adding a visible replacement can make a page harder to use.

The image also needs to scale well on smaller screens. max-width: 100% keeps it from spilling beyond its container, while height: auto preserves its proportions. A link can be perfectly valid HTML and still be frustrating if the image is clipped, tiny, or difficult to select.

A note on safety and good markup

When a link opens a new tab, rel="noopener" prevents the destination page from using window.opener to interact with the page that opened it. Modern browsers often provide this protection automatically for target="_blank", but including rel="noopener" remains a clear and sensible habit. If you don’t want the destination site to learn which page sent a visitor, you can also use noreferrer:


<a href="https://example.com" target="_blank" rel="noopener noreferrer">

<img src="/images/example-logo.jpg" alt="Visit Example (opens in a new tab)">

</a>

Use noreferrer only when that privacy behavior suits the link. It can affect referral information that some sites use to understand incoming traffic.

Also, give each image a useful file path and a meaningful text alternative. Decorative images may use alt=""; meaningful linked images should explain the action or destination. These small details help HTML carry its meaning, not just its appearance.

The short version

To make an image link, nest an <img> element inside an <a> element. Put the destination in href, and add target="_blank" if the link should request a new tab. Add rel="noopener" for a safer new-tab link, and write alt text that makes sense for the link’s purpose.

It’s a small piece of markup, but it brings together several core ideas: HTML structure, navigation, accessibility, and browser behavior. Get those pieces working together, and an image link becomes more than a picture with a click attached—it becomes a useful, understandable part of the page.