使用卡字幕类为卡设置字幕。
卡字幕类的用法如下所示-
<h4 class="card-title">Sports</h4>
在这里,我将字幕设置为“室内”作为示例。字幕类排在卡片标题的Bootstrap类之后-
<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://cdn.staticfile.org/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>