Skip to content

Instantly share code, notes, and snippets.

@sarvar
Last active February 12, 2017 21:21
Show Gist options
  • Save sarvar/58b6e978d2fcbfa87c66fa7d5af2da0a to your computer and use it in GitHub Desktop.
Save sarvar/58b6e978d2fcbfa87c66fa7d5af2da0a to your computer and use it in GitHub Desktop.
Similar post height with thumbnail
1) Jquery Solution:
$(".thumbnail").height(Math.max.apply(null, $(".thumbnail").map(function() { return $(this).height(); })));
2) CSS Solution:
<div class="flex-row row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="..." alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
</div>
</div>
</div>
</div>
@media only screen and (min-width : 481px) {
.flex-row.row {
display: flex;
flex-wrap: wrap;
}
.flex-row.row > [class*='col-'] {
display: flex;
flex-direction: column;
}
.flex-row.row:after,
.flex-row.row:before {
display: flex;
}
}
.flex-row .thumbnail,
.flex-row .caption {
flex:1 0 auto;
flex-direction:column;
}
.flex-text {
flex-grow:1
}
.flex-row img {
height:auto;
width:100%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment