javascript - bootstrap layout row with different heights -
i want add bootstrap row col-lg-3
class. div
contains different heights.hope add articles different length texts. my output designed expected output , here. code follows
<div class="row"> <div class="col-lg-3" style="background-color: #c5d5cb"><p style="height: 150px">1</p></div> <div class="col-lg-3" style="background-color: #9fa8a3"><p style="height: 200px">2</p></div> <div class="col-lg-3" style="background-color: #e3e0cf"><p style="height: 50px">3</p></div> <div class="col-lg-3" style="background-color: #b3c2bf"><p style="height: 60px">4</p></div> <div class="col-lg-3" style="background-color: #173e43"><p style="height: 44px">5</p></div> <div class="col-lg-3" style="background-color: #b56969"><p style="height: 70px">6</p></div> <div class="col-lg-3" style="background-color: #daad86"><p style="height: 20px">7</p></div> <div class="col-lg-3" style="background-color: #5a5c51"><p style="height: 35px">8</p></div> </div>
updated values put 1,2,3 etc comes mysql database. height equal text row numbers. php code follows `
foreach ($value $add) { echo "<div class='col-md-3'><p>"; echo $add->item; echo "</p></div>"; } ?>`
perhaps, ruin original code. change everywhere. hope helps you.
- add customized stylesheet inside tag head:
<style> .col-md-3{padding:0px;} // default: 15px -> left , right. </style>
- here's code:
<div class="container"> <div class="col-md-12"> <div class="col-md-3"> <div class="col-md-12" style="background-color: #c5d5cb;height: 150px;"> 1 </div> <div class="clearfix"></div> <div class="col-md-12" style="background-color: #173e43;height: 44px; color:white;"> 5 </div> </div> <div class="col-md-3"> <div class="col-md-12" style="background-color: #9fa8a3;height: 200px;"> 2 </div> <div class="clearfix"></div> <div class="col-md-12" style="background-color: #b56969;height: 70px;"> 6 </div> </div> <div class="col-md-3"> <div class="col-md-12" style="background-color: #e3e0cf;height: 50px;"> 3 </div> <div class="col-md-12" style="background-color: #daad86;height: 20px;"> 7 </div> </div> <div class="col-md-3"> <div class="col-md-12" style="background-color: #b3c2bf;height: 60px;"> 4 </div> <div class="col-md-12" style="background-color: #5a5c51;height: 35px;"> 8 </div> </div> </div> </div>
because don't know version of bootstrap, use v3.1.1
clearfix
... can customize based on version.
Comments
Post a Comment