I'm describing my desired outcome briefly - I want the inputs in the code to appear in the top left corner of a large image. Despite trying multiple approaches, I have been unable to achieve this layout. When considering 2 columns, the inputs should be positioned on the left side while the main image remains fixed on the right.
Please refer to the attached image for reference.
.gallery {
display: grid;
grid-gap: 20px;
max-width: 100%;
}
.gallery input[type="radio"] {
display: none;
}
.gallery label {
position: relative;
display: block;
padding-bottom: 60%;
margin: 5px;
cursor: pointer;
background-repeat: no-repeat;
background-size: cover;
background-position: 50% 50%;
}
.gallery label:before {
border: 1px solid #e3e3e3;
content: '';
position: absolute;
left: -5px;
right: -5px;
bottom: -5px;
top: -5px;
}
.gallery img {
display: none;
grid-column-start: 1;
grid-column-end: 8;
grid-row-end: 8;
width: 100%;
transition: all 150ms linear;
}
.gallery input[name="select"]:checked + label + img {
display: block;
}
.gallery input[name="select"]:checked + label:before {
border: 1px solid #000;
}
.overlay {
position: absolute;
top: 0;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5);
color: #f1f1f1;
width: 100%;
transition: .5s ease;
opacity: 1;
color: white;
font-size: 14px;
padding: 8px;
text-align: center;
}
/* On mouseover, fade in overlay title */
.overlay:hover {
opacity: 1;
background: rgb(255 255 255 / 91%);
color: black;
}
<div class="gallery">
<input type="radio" checked="checked" name="select" id="img-tab-1">
<label data-title="Sample Infotext" for="img-tab-1" style="background-image: url(http://www.wphizmetleri.com/felt/wp-content/uploads/2021/10/Pet-Felt-Panel-Acoustic-Orange-1.jpg);"><div class="overlay">Orange</div></label>
<img src="http://www.wphizmetleri.com/felt/wp-content/uploads/2021/10/Pet-Felt-Panel-Acoustic-Orange-1.jpg" border="0">
// Additional images and labels follow...
</div>