带BG-Dark类的Style Bootstrap 4卡
在Bootstrap4中使用bg-dark上下文类为卡添加灰色背景-
在下面的代码片段中,我使用了bg-dark类来设置Bootstrap卡的样式。有了这个,我也有课文课,将文本设置为白色-
<div class="card bg-dark text-white"> <div class="card-body">This is it!</div> </div>
让我们看看使用bg-dark类的完整示例-
示例
<!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>Notification</h2>
<div class="card bg-dark text-white">
<div class="card-body">This is it!</div>
</div><br>
<div class="card">
<div class="card-body">How you doing?</div>
</div><br>
</div>
</body>
</html>