Skip to main content Skip to docs navigation

垂直配置 Vertical alignment

inline、inline-block、inline-table、table cell要素の垂直配置を簡単に変更します。

vertical-alignmentユーティリティで要素の配置を変更します。vertical-alignはinline、inline-block、inline-table、table cell要素にのみ影響することに注意してください。

必要に応じて、.align-baseline.align-top.align-middle.align-bottom.align-text-bottom.align-text-topから選択します。

non-inlineコンテンツ(<div>など)を垂直方向に中央揃えするには、flex boxユーティリティを使用します。

inline要素の場合:

baseline top middle bottom text-top text-bottom
html
<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 cellの場合:

baseline top middle bottom text-top text-bottom
html
<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

Vertical alignユーティリティは、scss/_utilities.scssのutilities APIで宣言されています。utilities APIの使用方法を学びます。

"align": (
  property: vertical-align,
  class: align,
  values: baseline top middle bottom text-bottom text-top
),