设置 Bootstrap 按钮的激活状态


为了给 Bootstrap 按钮设置激活状态,使用 .active 类。

按钮将显示为按下状态,如下代码所示

示例

在线演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <p>The following are some buttons:</p>
      <button type = "button" class = "btn btn-default btn-lg ">
         Default Button
      </button>
      <button type = "button" class = "btn btn-default btn-lg active">
         Active Button
      </button>
   </body>
</html>

更新于: 2020 年 6 月 12 日

2K+ 浏览

开启你的 职业生涯

通过完成课程获得认证

开始学习
广告
© . All rights reserved.