It is necessary that when you click on the picture (a smaller version) on the screen appeared in the center of its larger version. The problem is that if there are a lot of pictures and the picture opens at the bottom, then when you close the picture, the page goes up. How can this be realized without a transition. I was advised to use the checkbox , but I do not really understand how to do it through them.
.pictures { -webkit-column-count: 4; -moz-column-count: 4; column-count: 4; -webkit-column-gap: 1em; -moz-column-gap: 1em; column-gap: 1em; margin-bottom: -1em; } a { display: inline-block; } img { display: block; width: 100%; margin-bottom: 1em; } .full { display: none; position: fixed; left: 0; top: 0; right: 0; bottom: 0; padding: 8%; background: #CCC center no-repeat; background: rgba(0, 0, 0, 0.5) center no-repeat; background-size: contain; background-origin: content-box; } .full:target { display: block; } <section class="pictures"> <a href="#pexels-photo-46871-large.jpeg"> <img src="https://static.pexels.com/photos/46871/pexels-photo-46871-large.jpeg"> </a> <a id="pexels-photo-46871-large.jpeg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/46871/pexels-photo-46871-large.jpeg)"></a> <a href="#pexels-photo-60163-large.jpeg"> <img src="https://static.pexels.com/photos/60163/pexels-photo-60163-large.jpeg"> </a> <a id="pexels-photo-60163-large.jpeg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/60163/pexels-photo-60163-large.jpeg)"></a> <a href="#vintage-technology-music-old-large.jpg"> <img src="https://static.pexels.com/photos/1539/vintage-technology-music-old-large.jpg"> </a> <a id="vintage-technology-music-old-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/1539/vintage-technology-music-old-large.jpg)"></a> <a href="#pexels-photo-large.jpg"> <img src="https://static.pexels.com/photos/36092/pexels-photo-large.jpg"> </a> <a id="pexels-photo-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/36092/pexels-photo-large.jpg)"></a> <a href="#car-orange-retro-large.jpg"> <img src="https://static.pexels.com/photos/9014/car-orange-retro-large.jpg"> </a> <a id="car-orange-retro-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/9014/car-orange-retro-large.jpg)"></a> <a href="#vintage-music-closed-shop-large.jpg"> <img src="https://static.pexels.com/photos/2017/vintage-music-closed-shop-large.jpg"> </a> <a id="vintage-music-closed-shop-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/2017/vintage-music-closed-shop-large.jpg)"></a> <a href="#pexels-photo-64687-large.jpeg"> <img src="https://static.pexels.com/photos/64687/pexels-photo-64687-large.jpeg"> </a> <a id="pexels-photo-64687-large.jpeg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/64687/pexels-photo-64687-large.jpeg)"></a> <a href="#black-and-white-car-vehicle-vintage-large.jpg"> <img src="https://static.pexels.com/photos/474/black-and-white-car-vehicle-vintage-large.jpg"> </a> <a id="black-and-white-car-vehicle-vintage-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/474/black-and-white-car-vehicle-vintage-large.jpg)"></a> <a href="#people-vintage-photo-memories-large.jpg"> <img src="https://static.pexels.com/photos/5842/people-vintage-photo-memories-large.jpg"> </a> <a id="people-vintage-photo-memories-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/5842/people-vintage-photo-memories-large.jpg)"></a> <a href="#building-vintage-bike-monument-large.jpg"> <img src="https://static.pexels.com/photos/2884/building-vintage-bike-monument-large.jpg"> </a> <a id="building-vintage-bike-monument-large.jpg" href="#" class="full" style="background-image:url(https://static.pexels.com/photos/2884/building-vintage-bike-monument-large.jpg)"></a> </section>