Science, Tech, Math › Computer Science How to Link an Image on Your Website Wrap an image element inside of an anchor element Share Flipboard Email Print adamkaz / Getty Images Science, Tech, Math PHP Programming Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Jennifer Kyrnin Jennifer Kyrnin Writer University of California University of Washington Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. Learn about our Editorial Process Updated on February 28, 2020 There's a difference between inserting an image on a webpage and making that image a clickable link. Although the HTML is similar, a link relies on an anchor element while an image uses the img element. However, an image may nest within an anchor, making that image clickable as a link. Inserting Images into Anchor Elements A common use of an image-based link is the site's logo graphic, which is then linked back to the site's homepage. Here's how you would place a non-clickable image in the HTML document: To transform the image into a link, add the anchor link, opening the anchor element before the image and closing the anchor after the image. This technique is similar to how you link text, except that instead of wrapping the words, you wrap the image: When you add this type of HTML to your page, don't put any spaces between the anchor tag and the image tag. If you do, some browsers will add little ticks beside the image, which will look odd. The logo now also acts as a homepage button, which is pretty much a web standard these days. Notice that we do not include any visual styles, such as the width and height of the image, in our HTML markup. We will leave these visual styles to CSS and maintain a clean separation of HTML structure and CSS styles. Cite this Article Format mla apa chicago Your Citation Kyrnin, Jennifer. "How to Link an Image on Your Website." ThoughtCo, Sep. 2, 2021, thoughtco.com/link-an-image-on-your-website-3468291. Kyrnin, Jennifer. (2021, September 2). How to Link an Image on Your Website. Retrieved from https://www.thoughtco.com/link-an-image-on-your-website-3468291 Kyrnin, Jennifer. "How to Link an Image on Your Website." ThoughtCo. https://www.thoughtco.com/link-an-image-on-your-website-3468291 (accessed March 27, 2023). copy citation