css - Equal height divs kept together side-by-side always -
using bootstrap 3.x , creating common 3 column layout. in desktop view want 3 divs in same row , same height. when shrunk down smallest width want first 2 divs remain next each other third drop below. always, first 2 divs should same height. if second div shorter first, third div ends underneath second, right of first.
<div class="row"> <div class="col-sm-12 col-md-9"> <!-- keep these 2 divs side side , same height --> <div class="col-xs-6 col-sm-6 col-md-6"> panel 1 </div> <div class="col-xs-6 col-sm-6 col-md-6"> panel 2 </div> </div> <div class="col-sm-12 col-md-3"> <!-- div should beside other 2 on large screens , drop below on xsmall screens --> side bar ad </div> </div>
here way visualize issue. first 2 need same height: http://www.bootply.com/29cnrjrewt
connie decinko, hi there.
have divs flow ask here way.
here fiddle.
said first 2 blocks should have same height not have issue 3rd block flowing below.
but, if second block shorter first block wrap first 2 block in row
, wrap 3rd block in row
, add row
3rd block col-xs-12
when on small screens takes full width.
<div class="container"> <div class="row text-center"> <div class="col-xs-6 col-sm-4 block1"><h2>block 1</h2></div> <div class="col-xs-6 col-sm-4 block2"><h2>block 2</h2></div> <div class="col-xs-6 col-sm-4 block3"><h2>block 3</h2></div> </div> </div>
if want have second block shorter.
way.
here fiddle.
note not using flex ... flex not have full browser support.
<div class="container"> <div class="row-fluid col-xs-12 col-sm-8 text-center clear"> <div class="col-xs-6 col-sm-6 block4"><h2>block 1</h2></div> <div class="col-xs-6 col-sm-6 block5"><h2>block 2</h2></div> </div> <div class="row-fluid col-xs-12 col-sm-4 text-center clear"> <div class="col-xs-6 col-sm-12 block6 "><h2>block 3</h2></div> </div> </div>
Comments
Post a Comment