通过在Bootstrap中使用card类和bg-secondary上下文类添加不太重要的内容。
此类添加灰色背景-
<div class="card bg-secondary text-white">
在里面,添加卡体-
<div class="card bg-secondary text-white"> <div class="card-body">English</div> </div>
您可以尝试运行以下代码以在Bootstrap中使用bg-secondary类实现card类-
<!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>Languages</h3> <div class="card bg-secondary text-white"> <div class="card-body">English</div> </div><br> <div class="card bg-secondary text-white"> <div class="card-body">French</div> </div><br> <div class="card bg-secondary text-white"> <div class="card-body">Chinese</div> </div><br> <div class="card bg-secondary text-white"> <div class="card-body">Russian</div> </div> </div> </body> </html>