Last active
March 15, 2016 09:10
-
-
Save bulbul84/2dc9d0b598c4335b03c4 to your computer and use it in GitHub Desktop.
Bootstrap 3 responsive columns of same height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="col-xs-12 col-sm-4 panel" style="background-color: red"> | |
some content | |
</div> | |
<div class="col-xs-6 col-sm-4 panel" style="background-color: yellow"> | |
kittenz | |
<img src="http://placekitten.com/100/100"> | |
</div> | |
<div class="col-xs-6 col-sm-4 panel" style="background-color: blue"> | |
some more content | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Solution 1 using negative margins (doesn't break responsiveness) */ | |
.row{ | |
overflow: hidden; | |
} | |
[class*="col-"]{ | |
margin-bottom: -99999px; | |
padding-bottom: 99999px; | |
} | |
/* Solution 2 using table */ | |
.row { | |
display: table; | |
} | |
[class*="col-"] { | |
float: none; | |
display: table-cell; | |
vertical-align: top; | |
} | |
/* Solution 3 using flex added August 2015. Comments posted before this don't apply to this solution. */ | |
.row { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
flex-wrap: wrap; | |
} | |
.row > [class*='col-'] { | |
display: flex; | |
flex-direction: column; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://bootbites.com/demos/equalheight-columns/demos.html | |
http://bootbites.com/tutorials/responsive-equal-height-columns-bootstrap | |
https://github.com/liabru/jquery-match-height | |
http://codepen.io/imohkay/pen/gpard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment