I'm currently using Bootstrap cards to create a gallery-like display of images. To style the images, I'm also utilizing the card-tall
class. Since these images are posters, they naturally occupy a lot of space.
Here's how it appears on the website:
https://i.sstatic.net/nlqy6.jpg
However, on mobile devices, it looks like this:
https://i.sstatic.net/pOQcX.png
The HTML structure for the posters is enclosed within a div
:
<div id = "all" class="photo-grid">
<div class="card card-tall" style="background-image:url(./img/portfolio/poster1.jpg)" >
</div>
<div class="card card-tall" style="background-image:url(./img/portfolio/poster4.jpg)">
</div>
</div>
Along with the CSS code:
* {
box-sizing: border-box;
}
body {
background: #fff;
color: #fff;
font-family: "Noto Sans", sans-serif;
}
.photo-grid {
height: 100%;
display: grid;
gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
grid-auto-rows: 240px;
margin-right: 10%;
margin-left: 10%;
margin-bottom: 3rem;
}
.card {
height: 100%;
width: 100%;
border-radius: 4px;
transition: transform 200ms ease-in-out;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
@media screen and (min-width: 600px) {
.card-tall {
grid-row: span 2 / auto;
}
.card-wide {
grid-column: span 2 / auto;
}
}
/* import fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
/* css variables */
@import url(./partials/_variables.css);
/* import global styling */
@import url(./partials/_global.css);
I need some assistance with this setup!