首页 > 电脑专区 > 电脑教程 >

Bootstrap4如何设置表格

来源:互联网 2023-02-21 18:16:28 246

今天小编分享一下Bootstrap4如何设置表格属性,做出漂亮的表格e9G办公区 - 实用经验教程分享!

Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

工具/原料

  • Bootstrap4

方法/步骤

  • 1

    Bootstrap4 基础表格e9G办公区 - 实用经验教程分享!

    Bootstrap4 通过 .table 类来设置基础表格的样式,实例如下:e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    table class="table">e9G办公区 - 实用经验教程分享!

    thead>e9G办公区 - 实用经验教程分享!

    tr>e9G办公区 - 实用经验教程分享!

    th>Firstname/th>e9G办公区 - 实用经验教程分享!

    th>Lastname/th>e9G办公区 - 实用经验教程分享!

    th>Email/th>e9G办公区 - 实用经验教程分享!

    /tr>e9G办公区 - 实用经验教程分享!

    /thead>e9G办公区 - 实用经验教程分享!

    tbody>e9G办公区 - 实用经验教程分享!

    tr>e9G办公区 - 实用经验教程分享!

    td>John/td>e9G办公区 - 实用经验教程分享!

    td>Doe/td>e9G办公区 - 实用经验教程分享!

    td>john@example.com/td>e9G办公区 - 实用经验教程分享!

    /tr>e9G办公区 - 实用经验教程分享!

    tr>e9G办公区 - 实用经验教程分享!

    td>Mary/td>e9G办公区 - 实用经验教程分享!

    td>Moe/td>e9G办公区 - 实用经验教程分享!

    td>mary@example.com/td>e9G办公区 - 实用经验教程分享!

    /tr>e9G办公区 - 实用经验教程分享!

    tr>e9G办公区 - 实用经验教程分享!

    td>July/td>e9G办公区 - 实用经验教程分享!

    td>Dooley/td>e9G办公区 - 实用经验教程分享!

    td>july@example.com/td>e9G办公区 - 实用经验教程分享!

    /tr>e9G办公区 - 实用经验教程分享!

    /tbody>e9G办公区 - 实用经验教程分享!

    /table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 2

    条纹表格e9G办公区 - 实用经验教程分享!

    通过添加.table-striped类,您将在tbody>内的行上看到条纹,如下面的实例所示:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-striped"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 3

    带边框表格e9G办公区 - 实用经验教程分享!

    .table-bordered类可以为表格添加边框e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-bordered"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 4

    鼠标悬停状态表格e9G办公区 - 实用经验教程分享!

    .table-hover类可以为表格的每一行添加鼠标悬停效果(灰色背景):e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-hover"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 5

    黑色背景表格e9G办公区 - 实用经验教程分享!

    .table-dark类可以为表格添加黑色背景:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-dark"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 5相关内容未经授权抓取自百度经验
  • 6

    黑色条纹表格e9G办公区 - 实用经验教程分享!

    联合使用.table-dark和.table-striped类可以创建黑色的条纹表格:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-dark table-striped"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 7

    鼠标悬停效果 - 黑色背景表格e9G办公区 - 实用经验教程分享!

    联合使用.table-dark和.table-hover类可以设置黑色背景表格的鼠标悬停效果:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-dark table-hover"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 8

    指定意义的颜色类e9G办公区 - 实用经验教程分享!

    通过指定意义的颜色类可以为表格的行或者单元格设置颜色:e9G办公区 - 实用经验教程分享!

    .table-primary蓝色: 指定这是一个重要的操作e9G办公区 - 实用经验教程分享!

    .table-success绿色: 指定这是一个允许执行的操作e9G办公区 - 实用经验教程分享!

    .table-danger红色: 指定这是可以危险的操作e9G办公区 - 实用经验教程分享!

    .table-info浅蓝色: 表示内容已变更e9G办公区 - 实用经验教程分享!

    .table-warning橘色: 表示需要注意的操作e9G办公区 - 实用经验教程分享!

    .table-active灰色: 用于鼠标悬停效果e9G办公区 - 实用经验教程分享!

    .table-secondary灰色: 表示内容不怎么重要e9G办公区 - 实用经验教程分享!

    .table-light浅灰色,可以是表格行的背景e9G办公区 - 实用经验教程分享!

    .table-dark深灰色,可以是表格行的背景e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 9

    表头颜色e9G办公区 - 实用经验教程分享!

    在 Bootstrap v4.0.0-beta.2 中.thead-dark类用于给表头添加黑色背景,.thead-light类用于给表头添加灰色背景:e9G办公区 - 实用经验教程分享!

    在 Bootstrap v4.0.0-beta 这个版本中,.thead-inverse类用于给表头添加黑色背景,.thead-default类用于给表头添加灰色背景。e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 10

    较小的表格e9G办公区 - 实用经验教程分享!

    .table-sm类用于通过减少内边距来设置较小的表格:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    table class="table table-bordered table-sm"> thead> tr> th>Firstname/th> th>Lastname/th> th>Email/th> /tr> /thead> tbody> tr> td>John/td> td>Doe/td> td>john@example.com/td> /tr> tr> td>Mary/td> td>Moe/td> td>mary@example.com/td> /tr> tr> td>July/td> td>Dooley/td> td>july@example.com/td> /tr> /tbody>/table>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 11

    响应式表格e9G办公区 - 实用经验教程分享!

    .table-responsive类用于创建响应式表格:在屏幕宽度小于 992px 时会创建水平滚动条,如果可视区域宽度大于 992px 则显示不同效果(没有滚动条):e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    div class="table-responsive">table class="table"> thead> tr> th>#/th> th>Firstname/th> th>Lastname/th> th>Age/th> th>City/th> th>Country/th> th>Sex/th> th>Example/th> th>Example/th> th>Example/th> th>Example/th> /tr> /thead> tbody> tr> td>1/td> td>Anna/td> td>Pitt/td> td>35/td> td>New York/td> td>USA/td> td>Female/td> td>Yes/td> td>Yes/td> td>Yes/td> td>Yes/td> /tr> /tbody>/table>/div>e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 12

    你可以通过以下类设定在指定屏幕宽度下显示滚动条:e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    .table-responsive-sm 576pxe9G办公区 - 实用经验教程分享!

    .table-responsive-md 768pxe9G办公区 - 实用经验教程分享!

    .table-responsive-lg 992pxe9G办公区 - 实用经验教程分享!

    .table-responsive-xl 1200pxe9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    实例e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    div class="table-responsive-sm"> table class="table"> ... /table>/div>e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    e9G办公区 - 实用经验教程分享!

    Bootstrap4如何设置表格e9G办公区 - 实用经验教程分享!

  • 注意事项

    • 本经验代码格式适用于Bootstrap4,可能不适用其他版本。

    以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!e9G办公区 - 实用经验教程分享!


    标签: 表格操作系统设置

    办公区 Copyright © 2016-2023 www.bgqu.net. Some Rights Reserved. 备案号:湘ICP备2020019561号统计代码