為 Bootstrap 4 卡片新增灰色背景色
若要為 Bootstrap 4 卡片新增灰色背景色,請使用帶有`bg-dark`情境類的`card`類:
<div class="card bg-dark text-white">
在同一個`
`類中設定卡片主體:
<div class="card bg-dark text-white"> <div class="card-body">Hello</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://ajax.googleapis.com/ajax/libs/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>Welcome</h2> <div class="card bg-dark text-white"> <div class="card-body">Hello</div> </div> </div> </body> </html>
廣告
© .
All rights reserved.
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP