CSS flexbox 是开发前端的重要功能,tailwind CSS 中有四个 flex 可用,所有属性都以类形式覆盖。它是 CSS flex 属性的替代品,用于快速开发前端。用于设置灵活项目的长度。 flex 类响应迅速且对移动设备友好。很容易定位子元素和主容器。边距不会与内容边距一起折叠。无需编辑 HTML 部分即可轻松更改任何元素的顺序。
柔性:
- flex-1
- flex-initial
- flex-auto
- flex-none
flex-1:一个比率,指定项目相对于其余灵活项目将增长多少。它已被用于允许 flex 项目根据需要增长和收缩,忽略其初始大小。
句法:
Contents...
例子:
HTML
Tailwind flex-1 Class
GeeksforGeeks
Tailwind CSS flex-1 Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
HTML
Tailwind flex-initial Class
GeeksforGeeks
Tailwind CSS flex-initial Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
HTML
Tailwind flex-auto Class
GeeksforGeeks
Tailwind CSS flex-auto Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
HTML
Tailwind flex-none Class
GeeksforGeeks
Tailwind CSS flex-none Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
输出:
flex-initial:该类定义了该项目相对于其余灵活项目的增长幅度。考虑到它的初始大小,它已被用于允许 flex 项目收缩但不增长
句法:
..
例子:
HTML
Tailwind flex-initial Class
GeeksforGeeks
Tailwind CSS flex-initial Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
输出:
flex-auto:该类指定该项目相对于灵活项目的内容将增长多少。它已被用于允许 flex 项目根据需要增长和缩小,而忽略其初始大小。
句法:
Contents...
例子:
HTML
Tailwind flex-auto Class
GeeksforGeeks
Tailwind CSS flex-auto Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
输出:
flex-none:如果有额外的空间可用,这个类设置限制元素的增长或缩小。这是为了防止 flex item 增长或缩小,它只根据内容的大小占用空间
句法:
..
例子:
HTML
Tailwind flex-none Class
GeeksforGeeks
Tailwind CSS flex-none Class
This is the effect of flex-1:
Geeksforgeeks
Tailwind CSS
This is the effect of flex-initial:
Geeksforgeeks
A Computer Science for Geeks
This is the effect of flex-auto:
CSS
Cascading Style Sheet
This is the effect of flex-none:
HTML
Hypertext Markup Langauge
输出: