flex-flow शॉर्टहैंड प्रॉपर्टी flex-direction और flex-wrap को एक ही घोषणा में सेट करती है। यह फ्लेक्स कंटेनर के प्रवाह को परिभाषित करने का संक्षिप्त तरीका है।
उदाहरण: flex-flow: column wrap
आइटम्स वर्टिकल कॉलम में व्यवस्थित होते हैं और आवश्यकतानुसार रैप होते हैं।
<!DOCTYPE html>
<html>
<head>
<style>
.mycontainer {
display: flex;
background-color: orange;
flex-flow: column wrap; /* flex-direction: column; flex-wrap: wrap; */
gap: 10px;
padding: 10px;
height: 300px; /* रैप के लिए ऊंचाई सीमा */
}
.mycontainer > div {
background-color: white;
text-align: center;
line-height: 40px;
font-size: 25px;
width: 100px;
}
</style>
</head>
<body>
<h1>क्विज़</h1>
<div class="mycontainer">
<div>Q1</div>
<div>Q2</div>
<div>Q3</div>
<div>Q4</div>
<div>Q5</div>
<div>Q6</div>
<div>Q7</div>
<div>Q8</div>
<div>Q9</div>
</div>
</body>
</html>
flex-flow सिंटैक्स
flex-flow: <flex-direction> <flex-wrap>;
/* सामान्य संयोजन */
flex-flow: row wrap; /* हॉरिजॉन्टल, रैप के साथ */
flex-flow: column wrap; /* वर्टिकल, रैप के साथ */
flex-flow: row nowrap; /* डिफ़ॉल्ट: हॉरिजॉन्टल, नो रैप */
flex-flow: column-reverse wrap; /* उल्टा वर्टिकल, रैप के साथ */
कब उपयोग करें
- दोनों प्रॉपर्टीज़ एक साथ सेट कर रहे हों
- कोड को संक्षिप्त और पठनीय रखना चाहते हों
- मीडिया क्वेरीज़ में दोनों बदल रहे हों
मीडिया क्वेरी में उदाहरण
.container {
display: flex;
flex-flow: column wrap; /* मोबाइल */
}
@media (min-width: 768px) {
.container {
flex-flow: row nowrap; /* डेस्कटॉप */
}
}