I am complete beginner to HTML/CSS and I am trying to make an image gallery with thumbnails with CSS/HTML Only.
I want to stack photos in a div with opacity "0" and change opacity to "1" once thumbnail is clicked (input= checked)
Been stuck on this for weeks and I was wondering if anyone could help
here is my current code which doesn't work... I would appreciate any help
Thanks in advance!
.mainphoto img {
position: absolute;
opacity: 0;
}
input[name="selector"]:checked ~ .mainphoto img {
opacity: 1;
z-index: 1;
}
<div class="thumb1">
<input type="radio" name="selector" id="thumb1" checked="checked">
<label for="thumb1">
<img class="thumb" src="1.jpg" width="100" >
</label>
</div>
<div class="mainphoto"><img src="1.jpg" width="500"> </div>