Bootstrap 等列高度尺寸

发布于 2025-01-10 01:44:22 字数 4457 浏览 0 评论 0原文

我想使第一行之后的列即使具有动态内容(转到整页),也使 col-md-6 的高度相等。

<html>

<head>
  <title>Page Title</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <!--JS-->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>

<body>
  <div class="col-xs-3">
    <div class="row">
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                <p>Date</p>
              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
            <!-- This needs to get the latest unread message -->
            <!-- {% if unreadMessagesCount %}
                            <p>Unread: {{unreadMessagesCount}}</p>
                    
                            {% if inbox %}
                                <div>
                                    <p>{{inbox.first.sender}}</p>
                                </div>
                                <div>
                                    <div>
                                        <p>{{inbox.first.subject}}</p>
                                    </div>
                                </div>
                                {{inbox.first.text}}
                                {{inbox.first.time}}
                            {% endif %}
                        {% else %}
                            <p>Unread: 0</p>
                            <div>
                                <p>There are no senders</p>
                            </div>
                        {% endif %}  -->
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                More stuff than possible
                <!-- {% if request.user.refresh_token != "" %}
                                    <div>
                                        There are maybe some
                                    </div>
                                    {% else %}
                                    <div>
                                        There are no calendar events
                                    </div>
                                {% endif %}  -->

              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- This needs to get the earliest calendar event -->
    </div>
  </div>
</body>

</html>

I would like to make the columns after the first row so col-md-6 to be equal height even with dynamic content (go to full page).

<html>

<head>
  <title>Page Title</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <!--JS-->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>

<body>
  <div class="col-xs-3">
    <div class="row">
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                <p>Date</p>
              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
            <!-- This needs to get the latest unread message -->
            <!-- {% if unreadMessagesCount %}
                            <p>Unread: {{unreadMessagesCount}}</p>
                    
                            {% if inbox %}
                                <div>
                                    <p>{{inbox.first.sender}}</p>
                                </div>
                                <div>
                                    <div>
                                        <p>{{inbox.first.subject}}</p>
                                    </div>
                                </div>
                                {{inbox.first.text}}
                                {{inbox.first.time}}
                            {% endif %}
                        {% else %}
                            <p>Unread: 0</p>
                            <div>
                                <p>There are no senders</p>
                            </div>
                        {% endif %}  -->
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                More stuff than possible
                <!-- {% if request.user.refresh_token != "" %}
                                    <div>
                                        There are maybe some
                                    </div>
                                    {% else %}
                                    <div>
                                        There are no calendar events
                                    </div>
                                {% endif %}  -->

              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- This needs to get the earliest calendar event -->
    </div>
  </div>
</body>

</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法唧唧 2025-01-17 01:44:22

h-100height: 100%; 添加到两列的 col-md-6 列开始的第一个子项。

<html>

<head>
  <title>Page Title</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <!--JS-->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>

<body>
  <div class="col-xs-3">
    <div class="row">
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded h-100">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                <p>Date</p>
              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
            <!-- This needs to get the latest unread message -->
            <!-- {% if unreadMessagesCount %}
                            <p>Unread: {{unreadMessagesCount}}</p>
                    
                            {% if inbox %}
                                <div>
                                    <p>{{inbox.first.sender}}</p>
                                </div>
                                <div>
                                    <div>
                                        <p>{{inbox.first.subject}}</p>
                                    </div>
                                </div>
                                {{inbox.first.text}}
                                {{inbox.first.time}}
                            {% endif %}
                        {% else %}
                            <p>Unread: 0</p>
                            <div>
                                <p>There are no senders</p>
                            </div>
                        {% endif %}  -->
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded h-100">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                More stuff than possible
                <!-- {% if request.user.refresh_token != "" %}
                                    <div>
                                        There are maybe some
                                    </div>
                                    {% else %}
                                    <div>
                                        There are no calendar events
                                    </div>
                                {% endif %}  -->

              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- This needs to get the earliest calendar event -->
    </div>
  </div>
</body>

</html>

Add h-100 or height: 100%; to the first child of col-md-6 column start for both columns.

<html>

<head>
  <title>Page Title</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <!--JS-->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>

<body>
  <div class="col-xs-3">
    <div class="row">
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded h-100">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                <p>Date</p>
              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
            <!-- This needs to get the latest unread message -->
            <!-- {% if unreadMessagesCount %}
                            <p>Unread: {{unreadMessagesCount}}</p>
                    
                            {% if inbox %}
                                <div>
                                    <p>{{inbox.first.sender}}</p>
                                </div>
                                <div>
                                    <div>
                                        <p>{{inbox.first.subject}}</p>
                                    </div>
                                </div>
                                {{inbox.first.text}}
                                {{inbox.first.time}}
                            {% endif %}
                        {% else %}
                            <p>Unread: 0</p>
                            <div>
                                <p>There are no senders</p>
                            </div>
                        {% endif %}  -->
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="shadow p-3 mb-5 bg-white rounded h-100">
          <div class="container">
            <div class="row">
              <div class="col-md-6">
                -Icon-
              </div>
              <div class="col-md-6">
                More stuff than possible
                <!-- {% if request.user.refresh_token != "" %}
                                    <div>
                                        There are maybe some
                                    </div>
                                    {% else %}
                                    <div>
                                        There are no calendar events
                                    </div>
                                {% endif %}  -->

              </div>
            </div>

          </div>
          <p>Author</p>
          <div class="row">
            <div class="col-md-6">
              <p>Time</p>
            </div>

            <div class="col-md-6">
              <div>

              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- This needs to get the earliest calendar event -->
    </div>
  </div>
</body>

</html>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文