使用 Bootstrap 為某個表格行或單元格應用懸停顏色


若要為某個表格行或單元格應用懸停顏色,請使用 .active 類。你可以嘗試執行以下程式碼來實現 .active 類 -

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Table</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 = "table-responsive">
         <table class = "table">
            <thead>
               <tr>
                  <th>Subject</th>
                  <th>Marks</th>
                  <th>Type</th>
               </tr>
            </thead>
            <tbody>
               <tr class = "active">
                  <td>C++</td>
                  <td>70</td>
                  <td>Programming Language</td>
               </tr>
               <tr>
                  <td>PHP</td>
                  <td>92</td>
                  <td>Scripting Language</td>
               </tr>
               <tr>
                  <td>jQuery</td>
                  <td>80</td>
                  <td>JavaScript Library</td>
               </tr>
            </tbody>
         </table>
      </div>
   </body>
</html>

更新於: 2020 年 6 月 12 日

408 次瀏覽

開啟你的 職業生涯

參加課程,獲得證書

開始學習
廣告
© . All rights reserved.