vertical-alignmentユーティリティを使用して、要素の整列を変更します。垂直方向の整列はinline、inline-block、inline-table、table cellにのみ影響することに注意してください。
必要に応じて .align-baseline、.align-top、.align-middle、.align-bottom、.align-text-bottom、.align-text-topから選択してください。
インラインではないコンテンツ(<div>など)を垂直方向の中央揃えにするには、フレックスユーティリティを使用します。
インライン要素:
baseline
top
middle
bottom
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>テーブルセル:
| baseline | top | middle | bottom | text-top | text-bottom |
<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のscss/_utilities.scssで宣言されています。ユーティリティAPIの使い方はこちら
"align": (
property: vertical-align,
class: align,
values: baseline top middle bottom text-bottom text-top
),