+ 4
Can I add a link to a image so that when the user click ,he or she can jump to another page
6 odpowiedzi
+ 4
<a href="www.sololearn.com"><img src="image.jpeg" alt="NoImage" height="100px" width="200px"/><a/>
+ 2
*edited*
<a href="https://www.example.com"></a>
<style>
a {
background-image:url("example.png");
}
</style>
+ 2
or make a background image in CSS and add it to the "a" element so its a link with a background image
+ 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
+ 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>.
0
thanks so much guys