使用 bg-success 類設定 Bootstrap 4 卡片的樣式


若要為 Bootstrap 中的卡片設定積極操作,請將 bg-success 類與 card 類結合使用

設定積極操作並使用“card bg-success”−

<div class="card bg-success text-white">

現在使用 card-body 類新增卡片主體−

<div class="card bg-success text-white">
  <div class="card-body">India won by 7 wickets</div>
</div>

你可以嘗試執行以下程式碼來應用 card-success 類−

示例

線上示例

<!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">
    <h3>Result</h3>
    <p>Result of the first two matches between India and Australia:</p>
    <div class="card bg-success text-white">
      <div class="card-body">India won by 10 runs</div>
    </div><br>
    <div class="card bg-success text-white">
      <div class="card-body">India won by 7 wickets</div>
    </div>
  </div>
</body>
</html>

更新於:18-6 月-2020

308 次瀏覽

開啟你的職業生涯之路

透過完成課程獲得認證

開始
廣告
© . All rights reserved.