vsllc
asked on
Add hyperlink to image
This is probably a very basic questions, but I'm have very little knowledge of coding. I have an image on my website, code below, and I want to make the entire image a hyperlink that when clicked will go to a new web page. How do I do this?
<img src="images/demo/test.png" border="0" alt="Test" width="220" height="454" />
I've tried this but it pushes the images below it down a couple of pixels from how they displayed without hyperlink.
<p><a href="http://www.yahoo.com"> <img src="images/demo/test.png" border="0" alt="Test" width="220" height="454" /></a></p>
Thanks.
<img src="images/demo/test.png"
I've tried this but it pushes the images below it down a couple of pixels from how they displayed without hyperlink.
<p><a href="http://www.yahoo.com"> <img src="images/demo/test.png"
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The reason why its pushed is because of the space between the a tag and the Image-Tag
Hi vslic,
You will also want to add the "target="_blank" to get your hyperlink to open in a new page. Such as the following:
Dewmec
You will also want to add the "target="_blank" to get your hyperlink to open in a new page. Such as the following:
<p><a href="http://www.yahoo.com" target="_blank"> <img src="images/demo/test.png" border="0" alt="Test" width="220" height="454" /></a></p>
That should allow you to click on the image test.png and it should open in a new tab or window in the browser to the yahoo.com website. Let me know how you make out with this.Dewmec
ASKER
poor beggar - I adjusted but it didn't change the spacing issue.
dewmec - thanks for the tip. For this purpose I am OK with it not opening a new window.
dewmec - thanks for the tip. For this purpose I am OK with it not opening a new window.
http://www.hyperlinkcode.com/html-image-hyperlink.php
Cherer,
Ian