In CSS, Flex Flow is a shorthand property that combines two other Flexbox properties: Flex Direction and Flex Wrap. The Flex Direction property defines the direction in which the flex items are laid out inside the flex container. The Flex Wrap property defines whether the flex items should wrap to the next line when they reach the end of the container.
The Flex Flow property allows you to set both Flex Direction and Flex Wrap properties in one declaration. This means that you can use Flex Flow to control the direction of the flex items and whether they should wrap to the next line.
The syntax for the Flex Flow property is as follows:
The possible values for the Flex Flow property are:
For example, to set the flex direction to column and the flex wrap to wrap, you can use the following code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="flex-wrap.css"> </head> <body> <div class="container"> <div class="flex-item box-1">Box-1</div> <div class="flex-item box-2">Box-2</div> <div class="flex-item box-3">Box-3</div> <div class="flex-item box-4">Box-4</div> <div class="flex-item box-5">Box-5</div> <div class="flex-item box-6">Box-6</div> <div class="flex-item box-7">Box-7</div> <div class="flex-item box-8">Box-8</div> <div class="flex-item box-9">Box-9</div> </div> </body> </html>
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;900&display=swap'); *{ margin: 0; padding: 0; font-family: 'Rubik', sans-serif; } .container{ border:5px solid black; } .flex-item{ color:white; font-size: 18px; padding: 16px; text-align: center; } .box-1{background-color: #1abc9c;} .box-2{background-color:#3498db;} .box-3{background-color: #2ecc71;} .box-4{background-color: #9b59b6;} .box-5{background-color:#34495e;} .box-6{background-color:#2980b9;} .box-7{background-color:#e74c3c;} .box-8{background-color: #d35400;} .box-9{background-color:#2c3e50;} /*-----------------------------------*/ .container{ display: flex; /* flex-direction,flex-wrap*/ flex-flow: row nowrap; flex-flow: row wrap; flex-flow: row wrap-reverse; height: 400px; flex-flow: column nowrap; flex-flow: column wrap; flex-flow: column wrap-reverse; }Live Preview
The given code defines a CSS class named .container that sets up a flex container using the display: flex; property. The flex-flow property is then used to control the direction and wrapping behavior of the flex items within the container.
The flex-flow property is a shorthand property that combines flex-direction and flex-wrap properties. The possible values for flex-direction are row, row-reverse, column, and column-reverse. The possible values for flex-wrap are nowrap, wrap, and wrap-reverse.
In the given code, flex-flow is used to set the flex-direction and flex-wrap properties as follows:
The height property is then used to set the height of the container to 400px.
Finally, flex-flow is used again to set the flex-direction and flex-wrap properties for a column layout as follows:
Overall, the given code shows how the flex-flow property can be used to control the layout of flex items within a flex container.
Flex Flow is a powerful property that allows you to control the layout of flex items in a flexible way. By using Flex Flow, you can create complex and responsive layouts with ease.
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions