使用 bg-warning 类设置 Bootstrap 4 卡片的样式

bootstrapweb developmentcss framework更新于 2024/1/25 22:04:17

在 Bootstrap 中,将 bg-warning 类与 card 类结合使用,即可在 Bootstrap 卡片上设置警告操作。

设置警告信息,例如 −

禁止穿越!
高压!

使用以下代码设置 Bootstrap 卡片的样式 −

<div class="card bg-warning">
  <div class="card-body">You are trespassing on private property!</div>
</div>

您可以尝试运行以下代码,使用 bg-warning 类设置 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>Warning</h3>
    <div class="card bg-warning">
      <div class="card-body">You are trespassing on private property!</div>
    </div>
  </div>
</body>
</html>

相关文章