Offset vertical position of div elements within Twitter Bootstrap

user1318135 picture user1318135 · Jun 28, 2012 · Viewed 8.6k times · Source

I'm attempting to correctly vertically align offsetting elements using Twitter Bootstrap with a fluid grid. (Note: Grid is customized to 30 columns)

Considering the red boxes, this is the attempted div placement: http://imgur.com/IkB2G This is the current actual placement with my code: http://imgur.com/oJ2mG

Here is the code I am using. Unsure how to get the lower red box to move into the empty space above it, per the images.

<div class="container-fluid nomargin">
<div class="row-fluid span30 nomargin"><div style="height:10px"></div></div>  <!--    Vertical spacing between menu and content-->
<div class="row-fluid">
<div class="span4"></div>
<div class="span16 white-box">
  <!--Body content-->
   <div style="height:100px"></div>
</div>
<div class="span6 white-box">
  <!--Body content-->
   <div style="height:300px"></div>
 </div>

 <div class="span16 white-box">
  <!--Body content-->
   <div style="height:100px"></div>
 </div>
 </div>

Answer

MDrollette picture MDrollette · Jun 28, 2012

You need to think of it as 2 columns, and in the left column you have nested rows. I can't make out the proper sizes from the code you posted. But hopefully this code will give you some inspiration.

<div class="row">
    <div class="span18">
        <div class="row">
            <div class="span18">This is a row on the left side.</div>
        </div>
        <div class="row">
            <div class="span18">This is a row on the left side.</div>
        </div>
    </div>
    <div class="span12">
        This is the content on the right side.
    </div>
</div>