I'm in the process of making a pure CSS gallery, this is what my code looks like at the moment:
body {
background: lightgrey
}
input[type=radio] {
display: none
}
#gallery {
width: 85vh;
height: 65vh;
margin: 0 auto;
background: pink
}
label > img {
width: 17vh
}
<div id="gallery">
<input id="img1" type="radio" name="img" checked>
<label for="img1" class="img img1">
<img src="http://thecodeplayer.com/uploads/media/00kih8g.jpg">
</label>
<input id="img2" type="radio" name="img">
<label for="img2" class="img img2">
<img src="http://thecodeplayer.com/uploads/media/00kih8g.jpg">
</label>
<input id="img3" type="radio" name="img">
<label for="img3" class="img img3">
<img src="http://thecodeplayer.com/uploads/media/00kih8g.jpg">
</label>
<input id="img4" type="radio" name="img">
<label for="img4" class="img img4">
<img src="http://thecodeplayer.com/uploads/media/00kih8g.jpg">
</label>
<input id="img5" type="radio" name="img">
<label for="img5" class="img img5">
<img src="http://thecodeplayer.com/uploads/media/00kih8g.jpg">
</label>
</div>
As you see, there exists a margin even though I set all margins and paddings to 0. Any idea what could be the reason?
Edit: Solved it by applying display: block to the images.