我的页面上有一排带有一些列的行。这些包含的卡在内容量上略有不同。但我希望这些高度都相同。



<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="row mx-2 d-flex align-content-stretch flex-wrap flex-grow-1">
  <div class="col-md-3 ">
    <div class="card">
      <img src="image1.jpg" class="img-fluid" alt="" />
      <div class="card-body overflow-hidden text-center">
        <h4 class="color-primary">card 1</h4>
        <p></p>
        <a href="" class="btn btn-info"><i class="zmdi zmdi-
       download"></i>download</a>
      </div>
    </div>
  </div>
  <div class="col-md-3 ">
    <div class="card">
      <img src="image1.jpg" class="img-fluid" alt="" />
      <div class="card-body overflow-hidden text-center">
        <h4 class="color-primary">card 1</h4>
        <p></p>
        <a href="" class="btn btn-info"><i class="zmdi zmdi-
           download"></i>download</a>
      </div>
    </div>
  </div>
  <div class="col-md-3 ">
    <div class="card">
      <img src="image1.jpg" class="img-fluid" alt="" />
      <div class="card-body overflow-hidden text-center">
        <h4 class="color-primary">card 1</h4>
        <p></p>
        <a href="" class="btn btn-info"><i class="zmdi zmdi-
       download"></i>download</a>
      </div>
    </div>
  </div>
  <div class="col-md-3 ">
    <div class="card">
      <img src="image1.jpg" class="img-fluid" alt="" />
      <div class="card-body overflow-hidden text-center">
        <h4 class="color-primary">card 1</h4>
        <p></p>
        <a href="" class="btn btn-info"><i class="zmdi zmdi-
            download"></i>download</a>
      </div>
    </div>
  </div>
</div>





如您所见,我尝试了内容拉伸和项目拉伸。两者都不起作用。

最佳答案

列高填充行引导程序4



<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>

<div class="row mx-2 d-flex align-content-stretch flex-wrap flex-grow-1">
  <div class="card-group">
  <div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
  <h5 class="card-title">card 1</h5>
  <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
  <a href="#" class="btn btn-primary">download</a>
</div>
  </div>
  <div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
  <h5 class="card-title">card 1</h5>
  <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
  <a href="#" class="btn btn-primary">download</a>
</div>
  </div>
  <div class="card">
<img src="..." class="card-img-top" alt="...">
<div class="card-body">
  <h5 class="card-title">card 1</h5>
  <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
  <a href="#" class="btn btn-primary">download</a>
</div>
  </div>
</div>
</div>

10-06 04:01