要在Bootstrap中设置不太重要的内容,请使用card类和bg-secondary上下文类,如下所示-
<div class="card bg-secondary text-white">
也使用card-body类设置卡体-
<div class="card bg-secondary text-white"> <div class="card-body">Fitness Trackers</div> </div>
让我们看看如何设置内容不太重要的卡片-
<!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>Fitness Products</h3> <div class="card bg-secondary text-white"> <div class="card-body">Fitness Trackers</div> </div ><br> <div class="card bg-secondary text-white"> <div class="card-body">Heart Rate Monitors</div> </div> </div> </body> </html>