CSS align-itemsคุณสมบัติ
ตัวอย่าง
จัดตำแหน่งการจัดตำแหน่งสำหรับรายการทั้งหมดขององค์ประกอบ <div> ที่ยืดหยุ่นได้:
div
{
display: flex;
align-items: center;
}
ความหมายและการใช้งาน
คุณสมบัติระบุ การalign-items
จัดตำแหน่งเริ่มต้นสำหรับรายการภายในคอนเทนเนอร์แบบยืดหยุ่น
เคล็ดลับ:ใช้คุณสมบัติalign-selfของแต่ละรายการเพื่อแทนที่align-items
คุณสมบัติ
ค่าเริ่มต้น: | ยืด |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ไม่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS3 |
ไวยากรณ์ JavaScript: | วัตถุ .style.alignItems="center" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Numbers ตามด้วย -webkit- ระบุเวอร์ชันแรกที่ทำงานกับคำนำหน้า
Property | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
ไวยากรณ์ CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
stretch | Default. Items are stretched to fit the container | |
center | Items are positioned at the center of the container | |
flex-start | Items are positioned at the beginning of the container | |
flex-end | Items are positioned at the end of the container | |
baseline | Items are positioned at the baseline of the container | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: คุณสมบัติการจัดตำแหน่งเนื้อหา
การอ้างอิง CSS: align-self property
การอ้างอิง HTML DOM: alignItems คุณสมบัติ