如何将一个容器(两行)放入bootstrap中的两个容器(两个不同的行)中?

时间:2017-02-11 05:36:29

标签: html css twitter-bootstrap bootstrap-modal

如何在引导程序中放置一个容器(两行)和两个容器(两个不同的行)?enter image description here

我想要像这样排列的容器

2 个答案:

答案 0 :(得分:1)

您可以使用网格来执行这些操作。 你能说明它应该是什么样的吗?(我可以帮助你更多)

编辑: 为此,您实际上只需要一行有两列。

它看起来像这样:

    <div class="row">

      <div class="col-md-8">  <!-- 8 is the width of the left side -->

        You content here

      </div>

     <div class="col-md-4">  <!-- 4 is the width of the right side -->

        Your content here

      </div>

    </div>

如果您需要这些列中的内容也是网格,那么它会有所不同:

   <div class="row">

      <div class="col-md-8">  <!-- 8 is the width of the left side -->

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

      </div>

     <div class="col-md-4">  <!-- 4 is the width of the right side -->

        <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

      </div>

    </div>

答案 1 :(得分:0)

使用此代码:

<!DOCTYPE html>
<html>
  <head>
    <title>Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
      .gray{border:5px solid gray;
        height: 100px;


      }
      .green{border: 5px solid green;
        height: 300px;
     }

        .orange{
          border: 5px solid orange;
          height: 350px;

        }

         .greenplus{border: 5px solid green;
        height: 50px;
       }
    </style>
    <body>
      <div class="container" style="margin-top: 50px;">
        <div class="row" >
          <div class="col-lg-8 col-sm-8 col-md-8">
            <div class="row"  style="padding-left: 20px; padding-right: 20px;">
              <div class="gray"></div>
             <br>
               <div class="green"></div>
             </div>
          </div>
          <div class="col-lg-4 col-sm-4 col-md-4">
            <div class="row" style="padding-left: 20px; padding-right: 20px;">
               <div class="orange"></div>
               <br>
               <div class="greenplus"></div>
             </div>
          </div>
        </div>
      </div>
    </body>
</html>