My struggle with aligning divs side by side continues. After searching through online forums for hours, I have yet to find a solution.
The goal is to create a collage using six images. However, currently all the images stack vertically on the left side one after another. These 6 images are set as backgrounds for individual divs within the "Collage" div. I attempted to use the float property on one of these relative divs, but it just vanished.
Usually, I would manually adjust everything using pixels, but this time I want a responsive layout.
How can I make the images appear next to each other responsively?
#collage-container {
max-width: 97%;
padding-right: 1%;
padding-left: 5%;
position: relative;
padding-bottom: 15%;
height: 0;
}
#collagecont2 {
position: relative;
max-width: 47%;
min-height: 70em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/PHALANTAFRONTPAGEAD.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont3 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/SANTACLAUSEFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont4 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/EXORBUTTERFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont5 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont6 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont1 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
.large:hover {
color: #FF0000;
}
.large {
position: absolute;
color: #00FF00;
font-family: arial;
font-size: 20pt;
bottom: 1%;
}
}
<div id="collage-container">
<div id="collagecont1">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont2">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont3">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont4">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont5">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont6">
<div class="large">
This is a DIV sample.
</div>
</div>
</div>