跳转到帖子
在手机APP中查看

一个更好的浏览方法。了解更多

OKCCN - XenForo & IPS Plugin Marketplace

主屏幕上的全屏APP,带有推送通知、徽章等。

在iOS和iPadOS上安装此APP
  1. 在Safari中轻敲分享图标
  2. 滚动菜单并轻敲添加到主屏幕
  3. 轻敲右上角的添加按钮。
在安卓上安装此APP
  1. 轻敲浏览器右上角的三个点菜单 (⋮) 。
  2. 轻敲添加到主屏幕安装APP
  3. 轻敲安装进行确认。
  • 选择语言

CSS Flex Container

推荐的帖子

  • 行政经理

CSS Flex Container


CSS Flex Container Properties

The flex container element can have the following properties:

  • display - Must be set to flex or inline-flex
  • flex-direction - Sets the display-direction of flex items
  • flex-wrap - Specifies whether the flex items should wrap or not
  • flex-flow - Shorthand property for flex-direction and flex-wrap
  • justify-content - Aligns the flex items when they do not use all available space on the main-axis (horizontally)
  • align-items - Aligns the flex items when they do not use all available space on the cross-axis (vertically)
  • align-content - Aligns the flex lines when there is extra space in the cross axis and flex items wrap

CSS flex-direction Property

The flex-direction property specifies the display-direction of flex items in the flex container.

This property can have one of the following values:

  • row (default)
  • column
  • row-reverse
  • column-reverse

Example

The row value is the default value, and it displays the flex items horizontally (from left to right):

.flex-container {
  display: flex;
  flex-direction: row;
}

Result:

1
2
3

Try it Yourself »

Example

The column value displays the flex items vertically (from top to bottom):

.flex-container {
  display: flex;
  flex-direction: column;
}

Result:

1
2
3

Try it Yourself »

Example

The row-reverse value displays the flex items horizontally (but from right to left):

.flex-container {
  display: flex;
  flex-direction: row-reverse;
}

Result:

1
2
3

Try it Yourself »

Example

The column-reverse value displays the flex items vertically (but from bottom to top):

.flex-container {
  display: flex;
  flex-direction: column-reverse;
}

Result:

1
2
3

Try it Yourself »



CSS flex-wrap Property

The flex-wrap property specifies whether the flex items should wrap or not, if there is not enough room for them on one flex line.

This property can have one of the following values:

  • nowrap (default)
  • wrap
  • wrap-reverse

Example

The nowrap value specifies that the flex items will not wrap (this is default):

.flex-container {
  display: flex;
  flex-wrap: nowrap;
}

Result:

1
2
3
4
5
6
7
8
9

Try it Yourself »

Example

The wrap value specifies that the flex items will wrap if necessary:

.flex-container {
  display: flex;
  flex-wrap: wrap;
}

Result:

1
2
3
4
5
6
7
8
9

Try it Yourself »

Example

The wrap-reverse value specifies that the flex items will wrap if necessary, in reverse order:

.flex-container {
  display: flex;
  flex-wrap: wrap-reverse;
}

Result:

1
2
3
4
5
6
7
8
9

Try it Yourself »


CSS flex-flow Property

The flex-flow property is a shorthand property for setting both the flex-direction and flex-wrap properties.

Example

.flex-container {
  display: flex;
  flex-flow: row wrap;
}

Try it Yourself »


Flex Container Subpages

Continue learning about flex container properties:

  • justify-content - horizontal alignment of flex items
  • align-items & align-content - vertical alignment and true centering



参与讨论

你可立刻发布并稍后注册。 如果你有帐户,立刻登录发布帖子。

游客
回帖…

帐户

导航

搜索

搜索

配置浏览器推送通知

Chrome (安卓)
  1. 轻敲地址栏旁的锁形图标。
  2. 轻敲权限 → 通知。
  3. 调整你的偏好。
Chrome (台式电脑)
  1. 点击地址栏中的挂锁图标。
  2. 选择网站设置。
  3. 找到通知选项并调整你的偏好。