How to create a new window in HTML for a single image

Updated: 03/10/2024 by Computer Hope
new window for html single image

In HTML (HyperText Markup Language), when placing a link to an image URL (Uniform Resource Locator) in the <a> tag, include target="_blank" in the tag to open a new browser tab.

Note

The target="_blank" attribute is deprecated and may not work in all browsers. Additionally, using target="_blank" can allow an attacker to insert, or inject, malicious code in the web page as it opens in a new tab. We strongly recommend against using target="_blank" for these reasons.

Example

<a href="https://www.computerhope.com/cdn/bigmb.jpg" target="_blank">Computer Motherboard</a>

Using the code above creates a link with the text "Computer Motherboard" that directs the user to a big picture of a computer motherboard.

Computer Motherboard