要为Bootstrap 4卡设置浅灰色背景,请使用bg-light类。
像在Bootstrap中使用其他类一样,使用“ card bg-light”-
<div class="card bg-light text-dark"> <div class="card-body">Image Editor</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"> <h2>Web Tools</h2> <div class="card bg-light text-dark"> <div class="card-body">Image Editor</div> </div> <div class="card bg-light text-dark"> <div class="card-body">Image Optimizer</div> </div> </div> </body> </html>