Skip to content

Instantly share code, notes, and snippets.

@conormcafee
Created October 7, 2015 09:29
Show Gist options
  • Save conormcafee/c7b5ade894230af88d76 to your computer and use it in GitHub Desktop.
Save conormcafee/c7b5ade894230af88d76 to your computer and use it in GitHub Desktop.
Flexbox Card
<section class="cards">
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>This is a really long description as I try to break the grid to see what happens the height of the divs</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
<div class="card">
<p>Title</p>
<p>Description</p>
<a href="#">Link</a>
</div>
</section>
.cards {
display: block;
background: red;
@media only screen and (min-width: 667px) {
display: flex;
flex-wrap: wrap;
}
}
.card {
padding: 15px;
background-color: rgba(0, 0, 0, 0.5);
border: 1px solid #ffffff;
@media only screen and (min-width: 667px) {
flex: 1 1 0px;
min-width: 50%;
background-color: rgba(0, 0, 0, 0.3);
}
@media only screen and (min-width: 992px) {
min-width: 25%;
background-color: rgba(0, 0, 0, 0.1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment