垂直方向の配置
インライン、インラインブロック、インラインテーブル、およびテーブルセルの要素の垂直方向の配置を簡単に変更します。
vertical-alignment
ユーティリティを使用して、要素の配置を変更します。vertical-alignは、インライン、インラインブロック、インラインテーブル、およびテーブルセルの要素にのみ影響することに注意してください。
必要に応じて、.align-baseline
、.align-top
、.align-middle
、.align-bottom
、.align-text-bottom
、および.align-text-top
から選択します。
(<div>
などの)インラインではないコンテンツを垂直方向に中央揃えにするには、フレックスボックスユーティリティを使用します。
インライン要素の場合
ベースライン 上 中央 下 テキスト上 テキスト下
<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
垂直方向の配置ユーティリティは、scss/_utilities.scss
のユーティリティAPIで宣言されています。ユーティリティAPIの使用方法について説明します。
"align": (
property: vertical-align,
class: align,
values: baseline top middle bottom text-bottom text-top
),