我如何使用bootstrap创建一个跨越其下一行的列?

时间:2015-07-08 14:04:26

标签: jquery html css twitter-bootstrap

我有一个3列布局的网站,我希望我的中间列的高度不同于侧栏,然后我有第2行的2列,我有col-pull-left和col-push - 我想要出现在大型中间栏旁边,但是我总是在我的大中柱下面第二排。我试图找出如何使用bootstrap这样做。有什么建议吗?

我尝试浮动中间列并浮动整行,我似乎无法使其工作,因为第二行总是清除第一行,因此它也会清除整个中心列。

我希望自己清楚明白。基本上我的代码看起来像这样,(即时删除php for wp)

<div class="row">
        <div id="contentWrap1" class="col-sm-3">
            <h3>Acerca de CIPM</h3>
            <hr>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce     eget neque gravida, faucibus lacus vel.</p>
        </div>
        <div id="contentWrap2" class="col-sm-4 col-sm-offset-1">
            //content
            //ths is the column that I want to be longer than the others because it contains many posts
        </div>
        <div id="contentWrap3" class="col-sm-3 col-sm-offset-1">
            <h3>C&oacute;digo de Etica</h3>
            <hr>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget neque gravida, faucibus lacus vel.</p>
        </div>
    </div>
    //now this is the second row that is displaying beneath the first one, however high the center column is, but i would like it to display up next to the center column, with the next #contentWraps on either side. Almost as if te content had 2 sidebars on each side, except i split them up this way for the responsive layout
    <div class="row">
        <div id="contentWrap4" class="col-sm-3 pull-left" style="float:left; clear: none;">
            <h3>Quicklinks</h3>
            <hr>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget neque gravida, faucibus lacus vel.</p>
        </div>
        <div id="contentWrap5" class="col-sm-3 pull-right">
            <h3>External Newsfeed</h3>
            <hr>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget neque gravida, faucibus lacus vel.</p>
        </div>
    </div>

1 个答案:

答案 0 :(得分:0)

不是将此布局视为两行,而是使用三列进行一行,每列都有自己的顶部&amp;底部。

<div class="row">
    <div id="left-col" class="col-sm-4">
        <div id="top-left"></div>
        <div id="bottom-left"></div>
    </div>
    <div id="middle-col" class="col-sm-4">
        <div></div>
    </div>
    <div id="right-col" class="col-sm-4">
        <div id="top-right"></div>
        <div id="bottom-right"></div>
    </div>
</div>