当前位置:网站首页>Shorthand for flex layout properties
Shorthand for flex layout properties
2022-08-08 05:44:00 【Cirrod】
flex 布局
flex 布局原理
全称 flexible box,弹性布局.
如何开启:为元素添加 display: flex.
开启 flex 布局的元素,称为 flex 容器(flex container),Its child elements become container members,称为 flex 项目.
flex 布局原理:通过给父盒子添加 display: flex,来控制子盒子的位置和排列方式.
flex Layout parent box common properties
flex-direction
设置主轴方向
| 属性值 | 含义 |
|---|---|
| row | 默认值,从左到右 |
| row-reverse | 从右到左 |
| column | 从上到下 |
| column-reverse | 从下到上 |
justify-content
设置主轴子元素排列方式
| 属性值 | 含义 |
|---|---|
| flex-start | 默认值,从头开始 |
| flex-end | 从尾部开始 |
| center | 居中 |
| space-around | 平分剩余空间 |
| space-between | Welt the child elements on both sides,再平分剩余空间 |
| space-evenly | The gaps between the subboxes are equal |
flex-wrap
设置子元素是否换行
默认不换行,If the child box width sum is greater than the parent box,will shrink!
| 属性值 | 含义 |
|---|---|
| wrap | 换行 |
| nowrap | 默认值,不换行 |
align-items
设置子元素在侧轴上的排列方式(Child elements are single-line)
| 属性值 | 含义 |
|---|---|
| flex-start | 侧轴头部开始 |
| flex-end | 侧轴尾部开始 |
| center | 侧轴居中 |
| stretch | 默认值,拉伸(Pull over the entire side shaft),Fails if the child element has a height set |
align-content
设置子元素在侧轴上的排列方式(Child elements are multiline)
| 属性值 | 含义 |
|---|---|
| flex-start | 默认值,侧轴头部开始 |
| flex-end | 侧轴尾部开始 |
| center | 侧轴居中 |
| stretch | The height of the child element is equal to the height of the parent element(Requires that child elements have no height set) |
| space-around | Bisects the lateral axis space |
| space-between | Welt the sides of the side shaft and divide the remaining space equally |
| space-evenly | The gaps between the subboxes are equal |
flex-flow
flex-direction 与 flex-wrap Composite notation of properties
son {
flex-flow: row wrap;
}
flex Layout subbox common properties
flex
flex 属性其实是 flex-grow、flex-shrink、flex-basis 三个属性的简写.
flex-grow The property value is a number,Used to set the expansion ratio of the flexbox,That is, the number of shares the box occupies in the remaining space,默认为 0.常见的 flex: 1 是 flex-grow 为 1.
flex-shrink The property value is a number,Used to set the shrink ratio of the box,It shrinks only when the sum of the widths of the child boxes is greater than the parent box.
flex-basis Used to set the initial length of the subbox.
span {
flex: 1;
}
.son {
flex: 0 0 33.33%;
}
align-self
Independently set the arrangement of a subbox on the side axis,它会覆盖 align-items 属性.默认值为 auto,Indicates that it inherits the parent box align-items 属性,The rest of the property values are AND align-items 相同.
order
Define the subbox in主轴上的排列顺序.默认值为 0,值越小越靠前,可以为负数.
.son {
order: -3;
}
边栏推荐
- Sequence table (below)
- 查询跟踪多家快递单号,筛选某一时间发货的单号
- postman---postman参数化
- Web attack log analysis: a guide for beginners
- Why do big Internet companies keep hiring while frantically laying off staff?
- 【Win10】Several sleep problems and countermeasures
- 【MySQL】——事务的基本概念
- Redis 的内存策略
- wpf中DataGrid的样式
- TSF Microservice Governance Combat Series (2) - Service Routing
猜你喜欢

浅学软件逆向笔记(1)

Web 攻击的日志分析:初学者指南
![Talk about the principle and implementation of Redis distributed lock [Ant Financial Services Three Sides]](/img/ed/dbaeab544066b5dbf19e71bee0f8c9.png)
Talk about the principle and implementation of Redis distributed lock [Ant Financial Services Three Sides]

IP核之RAM实验

Distributed Transactions: A Reliable Message Eventual Consistency Scheme

Unity-CharacterController(角色控制器)

Redis set to start automatically at boot

基本工具-NETCAT(telnet-banner、传输文本信息)

神经网络解决哪些问题,神经网络结果不稳定

仿记事本;QFile
随机推荐
Go-Excelize API源码阅读(十)—— SetActiveSheet(index int)
Redis设置开机自启动
Filter 过滤器的使用
《公共管理学》考试重点及答案
[u-boot] Analysis of the driver model of u-boot
String title parsing
预处理笔记
Matlab simulation of photovoltaic mppt maximum power control based on disturbance observation method
线程使用、控制、通信
postman---postman parameterization
webstorage
Week 8 Transformer Language Models and Implications
Preprocessing Notes
【matlab】matlab中变量赋值函数deal
关于如何做选择
[Redis] Redis Learning - Transaction
字符串题目解析
Flutter 教程之高效且精美的滚动组件Slivers (教程含源码)
【js基础】js的垃圾回收机制/内存回收机制
Database sub-database sub-table, when?How to divide?