HTML Image Link

How to make an image a link.

HTML image link code

<a href="../html-link.htm"><img src="flower.jpg" width="82" height="86" title="White flower" alt="Flower"></a>

Or better use css styling to determine the width and height.

<a href="../html-link.htm"><img src="flower.jpg" style="width:82px; height:86px" title="White flower" alt="Flower"></a>

The code will create this link:

Flower

 

The code has the following parts:

  • <a> is the link tag.
  • href attribute sets the URL to link to.
  • <img> is the image start tag.
  • src attribute sets the image file.
  • title attribute sets the image tooltip text.
  • alt is the image tag alt text attribute.
  • style attribute sets with css the width and height of the image.
  • </a> is the link end tag.

 


See also

Write how to improve this page