how to attach url link to an image?
199,563
Solution 1
"How to attach url link to an image?"
You do it like this:
<a href="http://www.google.com"><img src="http://www.google.com/intl/en_ALL/images/logo.gif"/></a>
See it in action.
Solution 2
Alternatively,
<style type="text/css">
#example {
display: block;
width: 30px;
height: 10px;
background: url(../images/example.png) no-repeat;
text-indent: -9999px;
}
</style>
<a href="http://www.example.com" id="example">See an example!</a>
More wordy, but it may benefit SEO, and it will look like nice simple text with CSS disabled.
Author by
Zach
Updated on March 03, 2020Comments
-
Zach about 4 years
I am creating an website. It contains videos of different places. Now my problem is i need integrate an image on that with url link. when user taps on that link it has to go to that link. Even user downloads the video also it has to go to that link (same link above linked to image).
-
Bozho over 14 yearsdon't forget to set the border of the image to 0, otherwise some browsers may add a nasty blue border around it.
-
Gregory Pakosz over 14 yearsyou're right, but I didn't want to go into styling considerations already
-
Gregory Pakosz over 14 yearsdns issues :/ should be fixed
-
Infant Dev almost 11 yearsHey alex, is there a way to add an image to a link without using a placeholder text??