使用card-group类在Bootstrap 4中创建一组卡-
<div class="card-group"> <div class="card bg-success"> <! - - One - - > </div> <div class="card bg-success"> <! - - Two - - > </div> <div class="card bg-success"> <! - - Three - - > </div> </div>
让我们在Bootstrap中创建一组像网格一样的卡-
<!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>Group of Messages</h3> <div class="card-group"> <div class="card bg-success"> <div class="card-body text-center text-white"> <p class="card-text">Argentina won convincingly!</p> </div> </div> <div class="card bg-primary"> <div class="card-body text-center"> <p class="card-text">Demo Text!</p> </div> </div> <div class="card bg-warning"> <div class="card-body text-center text-white"> <p class="card-text">Do not cross!</p> </div> </div> <div class="card bg-success"> <div class="card-body text-center"> <p class="card-text">I did it!</p> </div> </div> <div class="card bg-success"> <div class="card-body text-center"> <p class="card-text">It worked!</p> </div> </div> </div> </div> </body> </html>