HTML: Creating graphical hyperlink

This entry is part 34 of 34 in the series HTML

To create a hyperlink on an image, we place the <img> tag in an <a> tag.

You can refer to an earlier example where we have created a hyperlink to a webpage.

Codecrawl.com-Image

<!DOCTYPE html>
<html>
<head lang='en'>     
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Image</title>
</head>
<body>

<a href='http://en.wikipedia.org/wiki/Ushuaia' title='Ushuaia'><img src='//codecrawl.com/code/images/ushuaia1.jpg'></a>

</body>
</html>

Just in case that the image is not loaded for some reason, we could put an alternate text on the image.

<img src='//codecrawl.com/code/images/ushuaia1.jpg' alt='Ushuaia'>
Series Navigation<< HTML: Image margin