1. 程式人生 > 實用技巧 >bootstrap表格樣式

bootstrap表格樣式

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>我是中國人</title>

        <!-- 新 Bootstrap 核心 CSS 檔案 -->
        <link href="css/bootstrap.min.css"
rel="stylesheet"> <!-- 最新的 Bootstrap 核心 JavaScript 檔案 --> <script src="js/bootstrap.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script> </head> <body> <table border="" cellspacing
="" cellpadding="" class="table table-bordered table-hover table-striped table-condensed"> <tr> <th>名稱</th> <th>數量</th> <th>單價</th> </tr> <tr> <
td>玉米</td> <td>10</td> <td>3</td> </tr> <tr> <td>大豆</td> <td>20</td> <td>60</td> </tr> </table> </body> </html>

table:表格的基類,其他樣式都基於table

table-bordered:給表格加外邊框

table-hover:滑鼠懸停變色

table-striped:斑馬線效果,隔行換色

table-condensed:緊湊佈局