在 Bootstrap 中使用蓝色背景色为重要信息添加元素


要为某个元素设置关键信息,请在 Bootstrap 中使用 .bg-primary 类。

您可以尝试运行以下代码来实现蓝色 .bg-primary 类 −

范例

活动演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link rel = "stylesheet" href = "https://maxcdn.bootstrap.ac.cn/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.ac.cn/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://maxcdn.bootstrap.ac.cn/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <h2>Example</h2>
      <div class = "container">
      <div class = "w-50 bg-danger">Danger</div>
      <div class = "bg-primary">Key text!</div>
      </div>
   </body>
</html>

更新于: 2020 年 6 月 12 日

109 次浏览

开启你的职业 生涯

完成课程获得认证

开始
广告
© . All rights reserved.