Shahsays
Shahsays

Reputation: 431

Link on an image not working HTML

I have this logo

<img src="images/logo.png" style="margin-top: 7px; margin-left: 10px;width: 80px;" alt="">

now to add a link pn this image i use the plain old method

<a href="google.com"> <img src="images/logo.png" style="margin-top: 7px; margin-left: 10px;width: 80px;" alt=""> </a>

However this doesn't seem to work, Nothing happens on the image and it is not even clickable. Am I missing something? Should I try another way around ?

Upvotes: 0

Views: 1481

Answers (2)

AG_
AG_

Reputation: 2689

Add http:// for all external link.

check below snippet, you can't open google in iframe, so I changed the URL to stackoverflow

<a href="http://stackoverflow.com"> <img src="images/logo.png" style="margin-top: 7px; margin-left: 10px;width: 80px;" alt=""> </a>

Upvotes: 2

Loay Ashmawy
Loay Ashmawy

Reputation: 687

try this :

<a href="http://google.com" id="myimage" onclick="document.location=this.id+'.html';return false;"> <img src="images/logo.png" alt="myimage"/> </a>

Upvotes: 1

Related Questions