【问题标题】:How to place a container (two rows) inside with two containers (in two different rows) in bootstrap?如何在引导程序中放置一个容器(两行)和两个容器(在两行不同的行)?
【发布时间】:2017-08-07 21:44:22
【问题描述】:

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

我想要这样排列的容器

【问题讨论】:

  • 欢迎来到 StackOverflow!请提供您尝试的Minimal, Complete, and Verifiable example,例如作为Stack Snippet,因此我们可以尝试解决您的问题并解释您自己的尝试失败的原因 - 这样您就可以学到一些对您未来的发展有用的东西,并得到这个问题的答案。
  • 附上一张示例图片
  • 我想要这样排列的容器

标签: html css twitter-bootstrap bootstrap-modal


【解决方案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>

【讨论】:

  • 看一下附图
  • 你没有得到,我想问什么
  • @RISHABHBANSAL 那你能解释一下吗?
  • 先生,我已经在附图的帮助下进行了解释。我想要这样的分裂。这样我就可以用它们来写我的内容了
  • @RISHABHBANSAL 有没有这样安排的网站?我只是不明白你到底需要什么。这 4 个单独的容器是在两列中,还是在 2 列中只有 2 个容器?
【解决方案2】:

使用此代码:

<!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>

【讨论】:

    猜你喜欢
    • 2023-03-19
    • 2014-05-09
    • 2017-03-25
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    • 2020-10-11
    • 1970-01-01
    • 2014-04-03
    相关资源
    最近更新 更多