Can I add a link to a image so that when the user click ,he or she can jump to another page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can I add a link to a image so that when the user click ,he or she can jump to another page

18th Jul 2018, 10:55 PM
George S Mulbah II
George S Mulbah II - avatar
6 Answers
+ 4
<a href="www.sololearn.com"><img src="image.jpeg" alt="NoImage" height="100px" width="200px"/><a/>
19th Jul 2018, 2:06 PM
Tarika
Tarika - avatar
+ 2
*edited* <a href="https://www.example.com"></a> <style> a { background-image:url("example.png"); } </style>
18th Jul 2018, 11:09 PM
Roel
Roel - avatar
+ 2
or make a background image in CSS and add it to the "a" element so its a link with a background image
18th Jul 2018, 11:16 PM
Roel
Roel - avatar
+ 2
DDD yeah, that might indeed be an easier way to solve that problem, only thing is that i forgot it because im always using images with css (then i can change it with javascript if necessary) so maybe ill use that one soon thanks for remembering
19th Jul 2018, 3:09 AM
Roel
Roel - avatar
+ 1
Of course, but respect those rules. Whis HTML 5 the alt element is mandatory. Decorative images or as in caption should be given empty alt text (alt="") When an image has an empty alt attribute, screen readers ignore those images. If the image is informative the image must be given alternative text that describe the image (short phrases, for exemple :"red car") images content a link, must be given alternative text that présent the function of the link. Know I will show you how to have an image with a link. to have a simple image. <img src="URL" alt="alternatif text" /> the URL may be relative or direct (if you need an explication, tell me) <img /> element support png jpn and gif images. to have a link. <a href="URL">text that present the fonction of the link< /> link in an image you just need to replace the anchor text of <a> element by an <img> element. exemple a href="URL"><img src="image.jpg" alt="link function"></a>.
19th Jul 2018, 2:24 AM
DDD
DDD - avatar
0
thanks so much guys
19th Jul 2018, 3:47 PM
George S Mulbah II
George S Mulbah II - avatar