文档和示例,选择表%28的样式,考虑到它们在JavaScript插件%29中的优先使用和引导。
由于在第三方小部件(如日历和日期选择器)中广泛使用表,我们已经将表设计为选择加入.只需添加基类.table
给任何人,然后使用自定义样式或我们的各种包含的修饰符类进行扩展。
使用最基本的表标记,下面是.table
-以表为基础的表在Bootstrap中查找。所有表样式都是在Bootstrap 4中继承的。,这意味着任何嵌套表都将以与父表相同的方式样式。
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
你也可以倒置颜色-在黑暗的背景上的光文本-与.table-dark
...
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
类似于表和暗表,使用修饰符类.thead-light
或.thead-dark
使S看上去是浅灰色还是深灰色。
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
使用.table-striped
将斑马条添加到...
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
加.table-bordered
用于表格和单元格的所有边框。
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Mark | Otto | @TwBootstrap |
3 | Jacob | Thornton | @fat |
4 | Larry the Bird | @twitter |
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Mark | Otto | @TwBootstrap |
3 | Jacob | Thornton | @fat |
4 | Larry the Bird | @twitter |
加.table-hover
对象中的表行上启用悬停状态。...
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird | @twitter |
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird | @twitter |
加.table-sm
为了使桌子更紧凑,将细胞垫切成两半。
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird | @twitter |
# | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird | @twitter |
...
...
...
...
...
...
...
...
...
... | ... | ... | ... | ... | ... | ... | ... | ... |
普通表背景变体在暗表中不可用,但是可以使用文本或背景实用程序以达到类似的风格。
...
...
...
...
...
... | ... | ... | ... | ... |
使用颜色来增加意义只会提供一个视觉指示,不会传达给辅助技术的用户,比如屏幕阅读器。确保颜色所表示的信息从内容本身中明显可见。可见文本%29,或通过其他方法包括,例如隐藏在.sr-only
上课。
阿
函数就像表的标题。它帮助屏幕阅读器的用户找到一个表格,了解它的内容,并决定是否要阅读它。
List of users # | First Name | Last Name | Username |
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird | @twitter |
响应表允许轻松地水平滚动表。通过添加.table-responsive
上课.table
或者,通过添加.table-responsive{-sm|-md|-lg|-xl}
...
响应表使用overflow-y: hidden
,它剪辑掉超出表底部或顶部边缘的任何内容。特别是,这可以减少下拉菜单和其他第三方小部件。
使用.table-responsive{-sm|-md|-lg|-xl}
根据需要创建响应表,直到特定的断点。从该断点开始,表将正常运行,而不是水平滚动。
© 2011–2017 Twitter, Inc.
© 2011–2017 The Bootstrap Authors
根据CreativeCommonsAttributionLicense v3.0授权的文档。