发表日期: 2022-05-31 08:50:59 浏览次数:85
黑龙江省鹤岗网站建设-鹤岗网络公司-优化-制作-设计推广-鹤岗网站建设服务中心

在 Flexbox 布局模块(问世)之前,可用的布局模式有以下四种:
块(Block),用于网页中的部分(节)
行内(Inline),用于文本
表,用于二维表数据
定位,用于元素的明确位置
弹性框布局模块,可以更轻松地设计灵活的响应式布局结构,而无需使用浮动或定位。
所有现代浏览器均支持 flexbox 属性。
| 29.0 | 11.0 | 22.0 | 10 | 48 |
如需开始使用 Flexbox 模型,您需要首先定义 Flex 容器。
上面的元素表示一个带有三个 flex 项目的 flex 容器(蓝色区域)。
含有三个 flex 项目的 flex 容器:
<div class="flex-container"> <div>1</div> <div>2</div> <div>3</div> </div>
通过将 display 属性设置为 flex,flex 容器将可伸缩:
.flex-container {
display: flex;}以下是 flex 容器属性:
flex-direction
flex-wrap
flex-flow
justify-content
align-items
align-content
flex-direction 属性定义容器要在哪个方向上堆叠 flex 项目。
column 值设置垂直堆叠 flex 项目(从上到下):
.flex-container {
display: flex;
flex-direction: column;}column-reverse 值垂直堆叠 flex 项目(但从下到上):
.flex-container {
display: flex;
flex-direction: column-reverse;}row 值水平堆叠 flex 项目(从左到右):
.flex-container {
display: flex;
flex-direction: row;}row-reverse 值水平堆叠 flex 项目(但从右到左):
.flex-container {
display: flex;
flex-direction: row-reverse;}黑龙江省鹤岗网站建设-鹤岗网络公司-优化-制作-设计推广-鹤岗网站建设服务中心