当前位置:网站首页>弹性盒子flex
弹性盒子flex
2022-07-29 05:10:00 【冰眸js】
弹性盒子
Flex 布局,可以简便、完整、响应式地实现各种页面布局;
.box{ display:flex; }Webkit 内核的浏览器,必须加上
-webkit前缀;设为 Flex 布局以后,子元素的
float、clear和vertical-align属性将失效。Flex 布局的元素,称为 Flex 容器(flex container),简称"容器"。它的所有子元素自动成为容器成员,称为 Flex 项目(flex item),简称"项目"。
容器默认存在两根轴:水平的主轴(main axis)和垂直的交叉轴(cross axis)。主轴的开始位置(与边框的交叉点)叫做
main start,结束位置叫做main end;交叉轴的开始位置叫做cross start,结束位置叫做cross end。
容器属性
1.justify-content属性定义了项目在主轴上的对齐方式
flex-start:(默认值)左对齐flex-end:右对齐center: 居中space-between:两端对齐,项目之间的间隔都相等。space-around:每个项目两侧的间隔相等。- space-evenly:每两个项目之间的距离 与 边沿项目距离容器之间的距离相等
2.align-items属性定义项目在交叉轴上如何对齐
flex-start:交叉轴的起点对齐 居上对齐flex-end:交叉轴的终点对齐 居下对齐center:居中对齐baseline: 项目的第一行文字的基线对齐。stretch:默认值:如果项目未设置高度或设为auto,将占满整个容器的高度。
3.flex-direction属性决定主轴的方向(即项目的排列方向)
row:(默认值)主轴为水平方向,起点在左端。row-reverse:主轴为水平方向,起点在右端。column:主轴为垂直方向,起点在上侧。column-reverse:主轴为垂直方向,起点在下侧。
4.flex-wrap属性定义,如果一条轴线排不下,如何换行。
当容器空间不足时,项目比列缩小
空间有剩余,项目部会变大
nowrap:(默认)不换行wrap:换行,第一行在上方wrap-reverse:换行,第一行在下方
5.align-content属性定义了多根轴线的对齐方式
- flex-start:项目整体与交叉轴的起点对齐。居上
- flex-end:项目整体与交叉轴的终点对齐。居下
- center:项目整体与交叉轴的中点对齐。居中
- space-between:每两行之间的距离相等。
- space-around:每一行两侧的间隔都相等。
- space-evely: 每两行之间的距离 与 边沿项目距离容器之间的距离相等
- stretch(默认值):轴线占满整个交叉轴
边栏推荐
猜你喜欢

Detailed explanation of GPIO input and output

Database operation day 6

365 day challenge leetcode 1000 questions - day 040 design jump table + avoid flooding + find the latest grouping with size M + color ball with reduced sales value

Container security open source detection tool - veinmind (mirror backdoor, malicious samples, sensitive information, weak password, etc.)

重定向和文件

【C语言系列】— 把同学弄糊涂的 “常量” 与 “变量”

·来一篇编程之路的自我介绍吧·

【C语言系列】— 字符串+部分转义字符详解+注释小技巧

数据库操作 Day 6

Global components component registration
随机推荐
One dimensional array exercise
省市区三级联动(简单又完美)
Wechat applet video upload component is directly uploaded to Alibaba cloud OSS
EXIT中断详解
Detailed explanation of serial port communication
About local variables
Abstract classes and interfaces
Live broadcast preview | how to improve enterprise immunity through "intelligent edge security"?
Cryengine5 shader debugging
Clickhouse learning (V) cluster operation
ANSI C type qualifier
重定向和文件
一维数组练习
【C语言系列】— 把同学弄糊涂的 “常量” 与 “变量”
Day 1
Detailed explanation of exit interrupt
Global components component registration
ClickHouse学习(一)ClickHouse?
Day 3
Three handshakes and four waves for the interview summary