如何使引导卡具有相同的高度? 我知道我可以使用h-100,但就我而言,这是很大的-我需要像h-50这样的东西,但这不起作用。 我还尝试了h-25,但它也无法正常工作。
还有另一种技巧可以使卡片的高度相同吗?
答案 0 :(得分:0)
这是精确身高卡的工作示例 检查一下,让我知道它是否对您有帮助
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row mt-5">
<div class="col-3">
<div class="card h-100">
<img src="https://via.placeholder.com/300" class="img-fluid">
<p> This is card 1</p>
<p>With more text and description</p>
<p>blah blah blah</p>
</div>
</div>
<div class="col-3">
<div class="card h-100">
<img src="https://via.placeholder.com/300" class="img-fluid">
<p>This is card 2</p>
<p>with less text</p>
</div>
</div>
<div class="col-3">
<div class="card h-100">
<img src="https://via.placeholder.com/300" class="img-fluid">
<p>This is card 3</p>
</div>
</div>
<div class="col-3">
<div class="card h-100">
<img src="https://via.placeholder.com/300" class="img-fluid">
<p>All with equal heights</p>
</div>
</div>
</div>
</div>
</body>
</html>