flex-direction: column;
时间: 2023-10-14 13:21:23 浏览: 80
The `flex-direction: column;` is a CSS property used to define the direction in which the flex items are arranged in a flex container.
It sets the main axis to be vertical instead of horizontal, which means the flex items will be stacked on top of each other in a column rather than being side by side in a row. The cross axis remains horizontal.
This property is commonly used for creating responsive layouts, especially for mobile devices where the screen size is limited. By setting the flex-direction to column, the content will be easier to read and navigate on smaller screens.
Example:
```
.container {
display: flex;
flex-direction: column;
}
```
This code will make all the items inside the `.container` element to be stacked vertically in a column.
阅读全文