設定帶有標題的 Bootstrap 面板


按照以下步驟在 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>

更新於:12-6-2020

228

開啟您的 職業生涯

完成課程以獲得認證

開始
廣告