จัด รูปแบบคุณสมบัติเนื้อหา
❮ การ
❯
ตัวอย่าง
วางตำแหน่งรายการขององค์ประกอบ <div> ที่ยืดหยุ่นโดยมีช่องว่างระหว่างบรรทัด:
document.getElementById("main").style.alignContent = "space-between";
ความหมายและการใช้งาน
คุณสมบัติ alignContent จะจัดเรียงรายการของคอนเทนเนอร์แบบยืดหยุ่นเมื่อรายการไม่ได้ใช้พื้นที่ว่างทั้งหมดบนแกนตัดขวาง (แนวตั้ง)
เคล็ดลับ:ใช้คุณสมบัติ justifyContent เพื่อจัดแนวรายการบนแกนหลัก (ในแนวนอน)
หมายเหตุ:คุณสมบัตินี้ต้องมีรายการหลายรายการจึงจะมีผล
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Numbers ตามด้วย Webkit ระบุเวอร์ชันแรกที่ใช้งานได้กับคำนำหน้า
Property | |||||
---|---|---|---|---|---|
alignContent | 21.0 | 11.0 | 28.0 | 9.0 7.0 Webkit |
12.1 |
ไวยากรณ์
ส่งคืนคุณสมบัติ alignContent:
object.style.alignContent
ตั้งค่าคุณสมบัติ alignContent:
object.style.alignContent = "stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
stretch | Default value. 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 |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
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: คุณสมบัติการจัดตำแหน่งเนื้อหา
การอ้างอิง HTML DOM STYLE: alignItems property
อ้างอิง HTML DOM STYLE: alignSelf property
การอ้างอิงสไตล์ HTML DOM: justifyContent คุณสมบัติ
❮ การ
❯