3 ms·
> If I want my images to execute on click events, and so on, I probably have a reason for that. If that thing looks and works horrible, I'll learn that, but it
by thinkxl 7y ago
> If I want my images to execute on click events, and so on, I probably have a reason for that. If that thing looks and works horrible, I'll learn that, but it may also work perfectly, or in 99% nobody cares.
There's a semantic way to accomplish that. If the click event you want to add triggers an action inside the page you can do
<button aria-title="Open modal">
<img src="/img/surprised-pikachu.jpg" alt="Surprised Pikachu meme">
</button>
Or if clicking in the image takes you to a different page, then
<a href="#" aria-title="Visit the learn semantic HTML page">
<img src="/img/surprised-pikachu.jpg" alt="Surprised Pikachu meme">
</a>
Then you can add your click event to the surrounding element and add a few classes to remove the default stylings.