คุณสมบัติ HTML DOM Style flexFlow ใช้เพื่อระบุคุณสมบัติ flexDirection และ flexWrap ขององค์ประกอบ เป็นชวเลขสำหรับ flexDirection และ flexWrap และยอมรับค่าในลำดับเดียวกัน
ต่อไปนี้เป็นไวยากรณ์สำหรับ −
การตั้งค่าคุณสมบัติ flexFlow -
object.style.flexFlow = "flex-direction flex-wrap|initial|inherit"
อธิบายคุณสมบัติข้างต้นดังนี้ −
| ค่า | คำอธิบาย |
|---|---|
| flex-direction | ใช้สำหรับระบุทิศทางของรายการที่ยืดหยุ่นและค่าของมันคือ row, row-reverse, column, column-reverse, initial และ inherit ค่าเริ่มต้นคือแถว |
| flex-wrap | ใช้สำหรับระบุว่ารายการที่ยืดหยุ่นควรห่อหรือไม่ ค่าของมันคือ nowrap,wrap, wrap-reverse, initial และ inherit ค่าเริ่มต้นคือ isnowrap |
| ค่าเริ่มต้น | สำหรับการตั้งค่าคุณสมบัตินี้เป็นค่าเริ่มต้น |
| สืบทอด | ในการสืบทอดค่า parentproperty |
ให้เราดูตัวอย่างคุณสมบัติ flexFlow -
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
#demo {
width: 600px;
height: 190px;
border:1px solid black;
display: flex;
flex-flow: row-reverse no-wrap;
}
#demo div {
width:100px;
height:100px;
}
</style>
<script>
function changeFlexFlow() {
document.getElementById("demo").style.flexFlow="row wrap";
document.getElementById("Sample").innerHTML="The flex flow property is now set to row wrap";
}
</script>
</head>
<body>
<div id="demo">
<div><img src="https://www.tutorialspoint.com/images/css.png"></div>
<div>1</div>
<div><img src="https://www.tutorialspoint.com/images/Swift.png"></div>
<div>2</div>
<div><img src="https://www.tutorialspoint.com/images/reactjs.png"></div>
<div>3</div>
<div><img src="https://www.tutorialspoint.com/images/blockchain.png"></div>
<div>4</div>
<div><img src="https://www.tutorialspoint.com/images/3d.png"></div>
<div>5</div>
</div>
<p>Change the above container div flex flow property by clicking the below button</p>
<button onclick="changeFlexFlow()">Change Flex Flow</button>
<p id="Sample"></p>
</body>
</html> ผลลัพธ์

เมื่อคลิก “เปลี่ยน Flex Flow ปุ่ม −
