Bootstrap 4 .card-group 类


使用 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://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>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>

更新日期:18-6-2020

355 次浏览

启动你的职业

完成课程即可获得认证

立即开始
广告