ข้ามไปที่เนื้อหาหลัก ข้ามไปที่การนำทางเอกสาร
in English

การจัดตำแหน่งแนวตั้ง

เปลี่ยนการจัดแนวแนวตั้งขององค์ประกอบอินไลน์ อินไลน์บล็อก อินไลน์ตาราง และเซลล์ตารางได้อย่างง่ายดาย

เปลี่ยนการจัดตำแหน่งขององค์ประกอบด้วยvertical-alignmentยูทิลิตี้ โปรดทราบว่าการจัดแนวแนวตั้งจะมีผลกับองค์ประกอบแบบอินไลน์ อินไลน์บล็อค อินไลน์ตาราง และเซลล์ตารางเท่านั้น

เลือกจาก.align-baseline, .align-top, .align-middle, .align-bottom, .align-text-bottom, และ.align-text-topตามต้องการ

หากต้องการจัดเนื้อหาที่ไม่ใช่แบบอินไลน์ในแนวตั้ง (เช่น<div>และอื่นๆ) ให้ใช้flex box utilityของเรา

ด้วยองค์ประกอบแบบอินไลน์:

พื้นฐาน บน กลาง ล่าง ข้อความ บน ข้อความล่าง
<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>

ซาส

ยูทิลิตี้ API

ยูทิลิตี้การจัดแนวแนวตั้งได้รับการประกาศใน API ยูทิลิตี้ของเราในscss/_utilities.scss. เรียนรู้วิธีใช้ยูทิลิตี้ API

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