Bootstrap cards with 100% height and margin bottom

后端 未结 1 797
面向向阳花
面向向阳花 2020-12-10 02:12

I am attempting to develop a grid of Bootstrap 4 cards with the following requirements:

  • All cards must sit within one div class=\"row\", because I
相关标签:
1条回答
  • 2020-12-10 02:41

    After a little bit of experimentation, this one was easy to solve: I needed to add the mb-4 class to the containing column, not the card itself:

    <div class="container">
      <div class="row">
        <div class="col-md-4 col-sm-6 mb-4">
          <div class="card h-100" style="background-color:#ff0000;">
            Test card content. 
          </div>
        </div>
        <div class="col-md-4 col-sm-6 mb-4">
          <div class="card h-100" style="background-color:#00ff00;">
            Test card content. Test card content. Test card content. Test card content. 
          </div>
        </div>
        <div class="col-md-4 col-sm-6 mb-4">
          <div class="card h-100" style="background-color:#0000ff;">
            Test card content. Test card content. Test card content. Test card content. Test card content. Test card content. Test card content. Test card content. 
          </div>
        </div>
        <div class="col-md-4 col-sm-6 mb-4">
          <div class="card h-100" style="background-color:#0f0f0f;">
            Test card content. 
          </div>
        </div>
      </div>
    </div>
    

    Hopefully this helps others out who are stuck in my same situation.

    0 讨论(0)
提交回复
热议问题