Bootstrap 4 .card-subtitle 类
使用 card-subtitle 类为卡片设置副标题。
card-subtitle 类的用法如下 −
<h4 class="card-title">Sports</h4>
此处,我将副标题设置为示例“室内”。副标题类位于 Bootstrap card-title 类之后 −
<div class="card-body"> <h4 class="card-title">Sports</h4> <h6 class="card-subtitle text-muted">Indoor</h6> <p class="card-text">Squash, Dart, Chess</p> </div>
让我们了解一个 Bootstrap 4 中使用 card-subtitle 类的示例 −
示例
<!DOCTYPE html> <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.1.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h3>Indoor and Outdoor Sports</h3> <div class="card"> <div class="card-body"> <h4 class="card-title">Sports</h4> <h6 class="card-subtitle text-muted">Indoor</h6> <p class="card-text">Squash, Dart, Chess</p> </div> <div class="card-body"> <h4 class="card-title">Sports</h4> <h6 class="card-subtitle text-muted">Outdoor</h6> <p class="card-text">Cricket, Football, Hockey</p> </div> </div> </div> </body> </html>
广告