Các tiện ích để kiểm soát cách một mục lưới (grid item) riêng lẻ được căn chỉnh dọc theo trục inline của nó.
| Class | Styles |
|---|---|
justify-self-auto | justify-self: auto; |
justify-self-start | justify-self: start; |
justify-self-center | justify-self: center; |
justify-self-center-safe | justify-self: safe center; |
justify-self-end | justify-self: end; |
justify-self-end-safe | justify-self: safe end; |
justify-self-stretch | justify-self: stretch; |
Sử dụng tiện ích justify-self-auto để căn chỉnh một mục dựa trên giá trị thuộc tính justify-items của lưới:
<div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-auto ...">02</div> <!-- ... --></div>Sử dụng tiện ích justify-self-start để căn chỉnh một mục lưới về phía đầu trục inline của nó:
<div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-start ...">02</div> <!-- ... --></div>Sử dụng các tiện ích justify-self-center hoặc justify-self-center-safe để căn chỉnh một mục lưới dọc theo trung tâm trục inline của nó:
Thay đổi kích thước container để xem hành vi căn chỉnh
justify-self-center
justify-self-center-safe
<div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-center ...">02</div> <!-- ... --></div><div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-center-safe ...">02</div> <!-- ... --></div>Khi không có đủ không gian, tiện ích justify-self-center-safe sẽ căn chỉnh mục về phía đầu của container thay vì phía cuối.
Sử dụng các tiện ích justify-self-end hoặc justify-self-end-safe để căn chỉnh một mục lưới về phía cuối trục inline của nó:
Thay đổi kích thước container để xem hành vi căn chỉnh
justify-self-end
justify-self-end-safe
<div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-end ...">02</div> <!-- ... --></div><div class="grid justify-items-stretch ..."> <!-- ... --> <div class="justify-self-end-safe ...">02</div> <!-- ... --></div>Khi không có đủ không gian, tiện ích justify-self-end-safe sẽ căn chỉnh mục về phía đầu của container thay vì phía cuối.
Sử dụng tiện ích justify-self-stretch để kéo dãn một mục lưới để lấp đầy vùng lưới trên trục inline của nó:
<div class="grid justify-items-start ..."> <!-- ... --> <div class="justify-self-stretch ...">02</div> <!-- ... --></div>Prefix a justify-self utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<div class="justify-self-start md:justify-self-end ..."> <!-- ... --></div>Learn more about using variants in the variants documentation.