mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-22 21:22:52 +02:00
Make it possible to change default alignment & allow to inherit alignment from table (#29039)
This commit is contained in:
committed by
XhmikosR
parent
99676c7809
commit
62b8e84970
@@ -396,6 +396,43 @@ Add `.table-sm` to make any `.table` more compact by cutting all cell `padding`
|
||||
</table>
|
||||
{{< /example >}}
|
||||
|
||||
## Vertical alignment
|
||||
|
||||
Table cells of `<thead>` are always vertical aligned to the bottom. Table cells in `<tbody>` inherit their alignment from `<table>` and are aligned to the the top by default.
|
||||
|
||||
{{< example >}}
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-25">Heading 1</th>
|
||||
<th scope="col" class="w-25">Heading 2</th>
|
||||
<th scope="col" class="w-25">Heading 2</th>
|
||||
<th scope="col" class="w-25">Heading 4</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>This cell inherits <code>vertical-align: middle;</code> from the table</td>
|
||||
<td>This cell inherits <code>vertical-align: middle;</code> from the table</td>
|
||||
<td>This cell inherits <code>vertical-align: middle;</code> from the table</td>
|
||||
<td>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper.</td>
|
||||
</tr>
|
||||
<tr class="align-bottom">
|
||||
<td>This cell inherits <code>vertical-align: bottom;</code> from the table row</td>
|
||||
<td>This cell inherits <code>vertical-align: bottom;</code> from the table row</td>
|
||||
<td>This cell inherits <code>vertical-align: bottom;</code> from the table row</td>
|
||||
<td>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>This cell inherits <code>vertical-align: middle;</code> from the table</td>
|
||||
<td>This cell inherits <code>vertical-align: middle;</code> from the table</td>
|
||||
<td class="align-top">This cell is aligned to the top.</td>
|
||||
<td>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{< /example >}}
|
||||
|
||||
### Variants
|
||||
|
||||
Use contextual classes to color table rows or individual cells.
|
||||
|
Reference in New Issue
Block a user