【问题标题】:Bootstrap 4 and height of multiple elementsBootstrap 4和多个元素的高度
【发布时间】:2017-08-01 18:34:09
【问题描述】:

我很难解释我想要什么,所以我做了一个 mocup

如何用 bootstrap 4 做到这一点?所以目标是右侧的这 4 个元素始终(除了在移动设备上)与左侧的元素(图像)一样高。有人可以帮忙吗?现在是 makrup。

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>

<body>

  <div class="container">
    <section class="hero">
      <div class="row">
        <div class="col col-md-8"><img src="http://placehold.it/700x300/ccc/333.png?text=placeholder" alt=""></div>
        <div class="col col-md-4">
          <div class="contentMy">somthing</div>
          <div class="contentMy">somthing</div>
          <div class="contentMy">somthing</div>
          <div class="contentMy">somthing</div>
        </div>
      </div>
    </section>
  </div>
  <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</body>

</html>

【问题讨论】:

    标签: css twitter-bootstrap flexbox bootstrap-4 twitter-bootstrap-4


    【解决方案1】:

    您可以使用 Bootstrap 4 的新 flexbox 实用程序类。 d-flex类用于display:flex,然后flex-column用于设置flex-direction: column..

    <div class="container">
        <section class="hero">
            <div class="row">
                <div class="col col-md-8"><img src="" alt=""></div>
                <div class="col col-md-4 d-flex flex-column">
                    <div class="contentMy h-100">somthing</div>
                    <div class="contentMy h-100">somthing</div>
                    <div class="contentMy h-100">somthing</div>
                    <div class="contentMy h-100">somthing</div>
                </div>
            </div>
        </section>
    </div>
    

    http://www.codeply.com/go/YyTEyi4IcU

    【讨论】:

    • 太多了。我试图弄清楚新引导程序上的所有内容,但我没有弄清楚:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-20
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 2023-03-24
    • 2019-07-12
    • 2018-10-28
    相关资源
    最近更新 更多