轻松更改内联、内联块、内联表和表单元格元素的垂直对齐方式。
使用垂直对齐实用程序更改元素的对齐方式。请注意,垂直对齐仅影响内联、内联块、内联表和表格单元格元素。
根据需要从 、 和 中进行选择。.align-baseline.align-top.align-middle.align-bottom.align-text-bottom.align-text-top
要垂直居中非内联内容(如 s 等),请使用我们的 flex box 实用程序。<div>
使用内联元素:
基线顶部 中间底部 text-top text-bottom
<span class="align-baseline">baseline</span>
<span class="align-top">top</span>
<span class="align-middle">middle</span>
<span class="align-bottom">bottom</span>
<span class="align-text-top">text-top</span>
<span class="align-text-bottom">text-bottom</span> 使用表格单元格:
| 基线 | 返回页首 | 中间 | 底 | 文本顶部 | 文本底部 |
<table style="height: 100px;">
<tbody>
<tr>
<td class="align-baseline">baseline</td>
<td class="align-top">top</td>
<td class="align-middle">middle</td>
<td class="align-bottom">bottom</td>
<td class="align-text-top">text-top</td>
<td class="align-text-bottom">text-bottom</td>
</tr>
</tbody>
</table> CSS系统
Sass 实用程序 API
垂直对齐实用程序在我们的实用程序 API 中声明。了解如何使用实用工具 API。scss/_utilities.scss
"align": (
property: vertical-align,
class: align,
values: baseline top middle bottom text-bottom text-top
),

