I am trying to use a card-deck
in bootstrap 4 which contain cards with different width.
For single cards you do the following to change the width (or use class w-25
, w-50
or w-75
if the 25%, 50% or 75% width fit your needs):
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="card">
<div class="card-header">Header</div>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisici elit.</p>
</div>
</div>
<br>
<div class="card" style="width: 30%">
<div class="card-header">Header</div>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisici elit.</p>
</div>
</div>
<br>
<div class="card" style="width: 70%">
<div class="card-header">Header</div>
<div class="card-body">
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisici elit.</p>
</div>
</div>
</div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…