bootstrap在short-div中嵌套列

时间:2015-07-10 09:50:26

标签: css twitter-bootstrap grid nested

我对bootstrap相当新,我试图在附加图像中实现类似的功能,但我无法显示文本区域3和4。

以下是我的代码 欢迎任何建议。我正在寻找一个关于网格系统的好教程 这是图像的链接

<div class="container-fluid">
    <div class="jumbotron">
        <center>
            <h1>Bootstrap Tutorial</h1>

            <p>
                Bootstrap is the most popular HTML, CSS, and JS framework for developing
                responsive, mobile-first projects on the web.
            </p>

            <input type="button" class="btn btn-info" value="Order service ">

        </center>

    </div>
</div>


<div class="container-fluid">
    <div class="row">
        <div class="col-lg-8 col-md-8 col-sm-8" >


            <!-- first row 8 div-->
            <div class="short-div">
                <div class="well well-sm">
                    Bootstrap is the most popular HTML, CSS, and JS framework for developing
                    responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing
                    responsive, mobile-first projects on the web.
                </div>
            </div>

            <!-- second row 8 div-->
            <div class="short-div">
                <div class="well well-sm">
                    Bootstrap is the most popular HTML, CSS, and JS framework for developing
                    responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing
                    responsive, mobile-first projects on the web.
                </div>
            </div>


              <!-- third row 8 div-->
            <div class="short-div">

                <!--left 4 div-->
                <div class="col-md-4 col-sm-4" style="background-color:forestgreen">

                </div>

                <!--right 4 div-->
                <div class="col-md-4 col-sm-4" style="background-color:blue">

                </div>

            </div>
                </div>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

请记住,当您想要细分一行时,您需要计算相对于父元素而不是正文的12格系的宽度。

使用col-md-6代替col-md-4,因为它会将父元素划分为列而不是三列。

您需要的布局位于以下代码中:

&#13;
&#13;
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
  <div class="jumbotron">
    <center>
      <h1>Bootstrap Tutorial</h1>

      <p>
        Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
      </p>

      <input type="button" class="btn btn-info" value="Order service ">

    </center>

  </div>
</div>


<div class="container-fluid">
  <div class="row">
    <div class="col-lg-8 col-md-8 col-sm-8">


      <!-- first row 8 div-->
      <div class="short-div">
        <div class="well well-sm">
          Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
        </div>
      </div>

      <!-- second row 8 div-->
      <div class="short-div">
        <div class="well well-sm">
          Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
        </div>
      </div>


      <!-- third row 8 div-->
      <div class="short-div">

        <!--left 4 div-->
        <div class="col-xs-6 col-md-6 col-sm-6 well">
          Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
        </div>

        <!--right 4 div-->
        <div class="col-xs-6 col-md-6 col-sm-6 well">
          Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
        </div>

      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;