สไตล์justifyคุณสมบัติ เนื้อหา
ตัวอย่าง
ทำให้ช่องว่างระหว่างรายการของ <div> องค์ประกอบที่ยืดหยุ่น:
document.getElementById("main").style.justifyContent = "space-between";
ความหมายและการใช้งาน
คุณสมบัติ justifyContent จะจัดเรียงรายการของคอนเทนเนอร์แบบยืดหยุ่นเมื่อรายการไม่ได้ใช้พื้นที่ว่างทั้งหมดบนแกนหลัก (ในแนวนอน)
เคล็ดลับ:ใช้คุณสมบัติ alignContent เพื่อจัดแนวรายการบนแกนขวาง (แนวตั้ง)
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ justifyContent:
object.style.justifyContent
ตั้งค่าคุณสมบัติ justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
flex-start | Default value. Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
center | Items are positioned at the center 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 |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | flex-start |
---|---|
คืนมูลค่า: | A String แทนคุณสมบัติ justify-content ของ element |
เวอร์ชัน CSS | CSS3 |
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: คุณสมบัติเนื้อหา justify
อ้างอิง HTML DOM STYLE: alignContent property
การอ้างอิง HTML DOM STYLE: alignItems property
อ้างอิง HTML DOM STYLE: alignSelf property
❮ สไตล์วัตถุ