Hi Community!
Currently, when we want to make clickable images, we do this:
before.html
<!DOCTYPE html>
<html>
<body>
<span>Open image link in a new tab:
<a href="http://www.google.com" target="_blank">
<img src="images.jpg" />
</a>
</span>
</body>
</html>
Notes
- The image is inside the anchor tag
after.html
<!DOCTYPE html>
<html>
<body>
<span>Open image link in a new tab:
<img src="images.jpg" href="http://www.google.com" target="_blank" />
</span>
</body>
</html>
Reasons
- In my view not having an href and target attribute within images is something semantically wrong - because it’s something you should have and you don’t.
- It’s necessary to create a kind of workaround in the html or use a library for javascript… because the html specification itself does not have this feature.
- Most of the mechanisms I use don’t allow
<a> inside <img/> </a>
- this is blocked! - So… an alternative to solve this would be if the img tag had the target and href attribute - This allows the html in my view to be more hypertext
Notes
- These views are observations and not criticisms.