จัด รูปแบบรายการคุณสมบัติ
ตัวอย่าง
วางตำแหน่งการจัดตำแหน่งสำหรับรายการทั้งหมดขององค์ประกอบ <div> แบบยืดหยุ่นที่จุดเริ่มต้นของคอนเทนเนอร์:
document.getElementById("main").style.alignItems = "flex-start";
ความหมายและการใช้งาน
คุณสมบัติ alignItems ระบุการจัดตำแหน่งเริ่มต้นสำหรับรายการภายในคอนเทนเนอร์แบบยืดหยุ่น
เคล็ดลับ:ใช้คุณสมบัติ align-self ของแต่ละรายการเพื่อแทนที่คุณสมบัติ align-items
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Numbers ตามด้วย Webkit ระบุเวอร์ชันแรกที่ใช้งานได้กับคำนำหน้า
Property | |||||
---|---|---|---|---|---|
alignItems | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
ไวยากรณ์
ส่งคืนคุณสมบัติ alignItems:
object.style.alignItems
ตั้งค่าคุณสมบัติ alignItems:
object.style.alignItems = "stretch|center|flex-start|flex-end|baseline|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
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 | CSS3 |
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: align-items property
การอ้างอิง HTML DOM STYLE: alignContent property
อ้างอิง HTML DOM STYLE: alignSelf property