当前位置:网站首页>Flexbox flex property
Flexbox flex property
2022-08-02 03:16:00 【Dummerd】
flex (flexible box, telescopic box)
-is another layout method in css, it is mainly used to replace the floating to complete the layout of the page
-flex can make elements flexible, allowing elements to change according to the size of the page
-flex container
- To use a flex box, an element must first be set as a flex container
-Set the elastic container through display
Display:flex sets a block-level flex container
Set display:inline-flex as an inline flex container
- elastic element
- the direct child of the flex container is the flex element (flex item)
Note: An element can be both a flex container and a flex element at the same time
One: Properties of Elastic Containers
1:flex-direction 2:flex-wrap
3:flex-flow 4:justify-content
5:align-items 6:align-content
1:flex-direction: ; specifies the arrangement of flex elements in the container
Optional values:
The default value of row, the flex elements are arranged horizontally in the container (left to right)
Main axis - left to right
Row-reverse Elastic elements are arranged horizontally in reverse (right to left) in the container
Main axis - right to left
The column elastic elements are arranged vertically (from top to bottom)
Main axis - top to bottom
Column-reverse elastic elements are arranged vertically (from bottom to top)
Main axis - bottom to top
Main axis: The arrangement direction of elastic elements is called the main axis
Side axis: the direction perpendicular to the main axis is called the side axis
2: flex-wrap: ;Set whether the flex element wraps automatically in the flex container
Optional values:
The default value of nowrap, the element will not wrap automatically
wrap element automatically wraps along the minor axis
wrap-reverse element wraps in the opposite direction of the minor axis
3:flex-flow: Shorthand properties for wrap and direction, and no ordering requirements
Default row nowrap
4:justify-content How to allocate empty space on the main axis (how the elements on the main axis are arranged)
Optional values:
flex-start elements are aligned along the main axis starting edge
flex-end elements are aligned along the end of the main axis
The center element is centered
Space-around whitespace is distributed to both sides of the element
Space-between whitespace evenly distributed between elements
Space-evenly whitespace is distributed to one side of the element (less compatibility)
5: align-items How to align on the secondary axis - the relationship between elements
Optional values:
The default value of stretch is to set the length of elements on the same line to the same value
The flex-start element does not stretch and is aligned along the minor axis
The flex-end element does not stretch and is aligned along the end edge of the minor axis
align center center
baseline baseline alignment (incorrect use)
6: align-content: ;Distribution of blank space on secondary axis
Optional values:
flex-start elements are aligned along the minor axis
flex-end elements are aligned along the end of the minor axis
The center element is centered
Space-around whitespace is distributed to both sides of the element
Space-between whitespace evenly distributed between elements
Space-evenly whitespace is distributed to one side of the element (less compatible)
边栏推荐
猜你喜欢
随机推荐
JSP WebSehll 后门脚本
黑马案例--实现 clock 时钟的web服务器
7-43 字符串关键字的散列映射 (25 分) 谜之测试点
线性代数学习笔记2-2:向量空间、子空间、最大无关组、基、秩与空间维数
Invalid bound statement (not found)出现的原因和解决方法
#{}和${}的区别
7-35 城市间紧急救援 (25 分)c语言(测试点二未通过)
VPS8504C 微功率隔离电源隔离芯片 VPSC源特科技
关于#sql#的问题:该怎么写sql语句,
三维数字孪生引擎与实景互动,案例解析
iVX低代码平台系列详解 -- 概述篇(二)
MySQL8.0.26 installation and configuration tutorial (windows 64-bit)
总体写作原则
mysql使用on duplicate key update批量更新数据
MySQL中的时间函数
Lua安装及常用命令使用
MySql中的like和in走不走索引
小程序(开发必备常识)1
面试必备!TCP协议经典十五连问!
JSP Webshell 免杀