Skip to content

Instantly share code, notes, and snippets.

@scottgruber
Last active April 11, 2019 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottgruber/e21fefb75ff47ae5f4cf2f4eddfe80ef to your computer and use it in GitHub Desktop.
Save scottgruber/e21fefb75ff47ae5f4cf2f4eddfe80ef to your computer and use it in GitHub Desktop.
Card List component using CSS Grid, Flexbox and Semantic HTML
.ioes-c-card-overlay-grid {
display: grid;
grid-gap: 2vw;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-rows: auto;
margin: 2vw;
}
.ioes-c-card-overlay figure {
display: flex;
position: relative;
}
.ioes-c-card-overlay img {
height: calc(350px * 9 / 16);
object-fit: cover;
width: 100%;
}
.ioes-c-card-overlay .bg-color {
background-color: rgba(0, 0, 0, 0.5);
height: 100%;
position: absolute;
top: 0;
width: 100%;
}
.ioes-c-card-overlay figcaption {
align-content: center;
justify-self: center;
left: 10%;
position: absolute;
text-align: center;
top: 30%;
width: 80%;
}
<section class="ioes-c-card-overlay-grid">
<article class="ioes-c-card-overlay">
<a href="#" rel="bookmark">
<figure>
<img src="" alt="" />
<div class="bg-color"></div>
<figcaption>
<h5 class="white">Title</h5>
<p class="yellow">Description</p>
</figcaption>
</figure>
</a>
</article>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment