设置带标题的 Bootstrap 面板

bootstrapweb developmentcss framework更新于 2026/2/12 12:28:17

按照以下步骤设置带标题 − 的 Bootstrap 面板

  • 使用 .panel-heading 类为面板添加标题容器。
  • 使用任意带有 .panel-title 类的 <h1>-<h6> 来添加预设样式的标题。

您可以尝试在 Bootstrap 中运行以下代码,为带标题的面板添加标题 −

示例

<!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>
      <div class = "panel panel-default">
         <div class = "panel-heading">
            Tutorials
         </div>
         <div class = "panel-body">
            Learn for free
         </div>
      </div>
         
      <div class = "panel panel-default">
         <div class = "panel-heading">
            <h3 class = "panel-title">
               Quiz
            </h3>
         </div>
               
         <div class = "panel-body">
            Attempt these quizzes
         </div>
      </div>
   </body>
</html>

相关文章