I have successfully made some <img>
elements act like <input type="radio">
buttons and now I want to visually indicate the user's selection by adding a border around the chosen image.
My challenge is that there are multiple rows of images, and I need the user to be able to click on an image in one row, have it stay highlighted, then click on an image in another row without losing the highlight on the previous selection.
.product-info .option img:active
{
border:1px solid #d9d1d5;
}
Here is an example code snippet:
.images img:active {
border:3px solid #000;
}
<div class="images">
<img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
<img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
<img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
<img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
</div>