当前位置:网站首页>flex布局原理及常见的父项元素
flex布局原理及常见的父项元素
2022-07-26 05:10:00 【Dummerd】
一.flex布局原理
采用Flex布局的元素,称为flex容器,它的所有子元素自动成为容器成员,称为Flex项目
总结flex布局原理:
就是通过给父元素添加flex属性,来控制子盒子的位置和排列方式
二.常见父项属性
1.flex-direction:设置主轴方向
2.justify-content:设置主轴上的子元素排列方式
3.flex-wrap:设置子元素是否换行
4.align-content:设置侧轴上的子元素的排列方式(多行)
5.align-items:设置侧轴上的子元素的排列方式(单行)
6.flex-flow:复合属性,相当于同时设置了flex-direction和flex-wrap
三.flex-direction设置主轴的方向
flex-direction属性决定主轴的方向(即项目的排列方向)
注意:主轴和侧轴会变化的,就看flex-direction设置谁为主轴,剩下的就是侧轴,而我们的子元素跟着主轴来排序的
row 默认值从左到右
row-reverse 从右到左
column 从上到下
column-reverse 从下到上
四.justify-content设置主轴上的子元素排列方式
justify-content属性定义了项目在主轴上的对齐方式
注意:使用这个属性之前一定要确定好主轴是哪个
flex-start 默认值从头开始,如果主轴是X轴,则从左到右
flex-end 从尾部开始排列
center 在主轴居中对齐(如果主轴是x轴则水平居中)
space-around 平分剩余空间
spance-between 先两边贴边 在平分剩余空间
五.flex-wrap设置子元素是否换行
nowrap 默认值,不换行
wrap 换行
边栏推荐
- MySQL eight knowledge points: from getting started to deleting the database
- JVM第五讲:纵横数据如何应对洪峰推送
- Recommendation system - machine learning
- 一次线上事故,我顿悟了异步的精髓
- Practical technology of SWAT Model in simulation of hydrology, water resources and non-point source pollution
- “双碳”目标下资源环境中的可计算一般均衡(CGE)模型实践技术
- Excel VBA:将多个工作表保存为新文件
- 时代潮流-云原生数据库的崛起
- Embedded sharing collection 20
- LeetCode链表问题——203.移除链表元素(一题一文学会链表)
猜你喜欢

推荐系统-机器学习

Black eat black? The man cracked the loopholes in the gambling website and "collected wool" for more than 100000 yuan per month

时代潮流-云原生数据库的崛起

AXI协议(4):AXI通道上的信号

nacos注册中心

手把手教你用代码实现SSO单点登录

地球系统模式(CESM)实践技术

Week 6 Learning Representation: Word Embedding (symbolic →numeric)

MySQL eight knowledge points: from getting started to deleting the database

uniapp小程序框架-一套代码,多段覆盖
随机推荐
JVM第二讲:类加载机制
Recommend 12 academic websites for free literature search, and suggest to like and collect!
阿里三面:MQ 消息丢失、重复、积压问题,如何解决?
Nacos 介绍和部署
nacos注册中心
Yolov5 implementation process - Directory
ALV程序收集
[Luogu] p1383 advanced typewriter
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
Embedded sharing collection 21
CountLaunch Demo的测试
BigDecimal 的 4 个坑,你踩过几个?
Shell流程控制(重点)、if 判断、case 语句、let用法、for 循环中有for (( 初始值;循环控制条件;变量变化 ))和for 变量 in 值 1 值 2 值 3… 、while 循环
提高shuffle操作中的reduce并行度
Nacos introduction and deployment
Redis solves the problem of oversold inventory
未来大气污染变化模拟
Mysql主从同步及主从同步延迟解决方案
Install nccl \ mpirun \ horovod \ NVIDIA tensorflow (3090ti)
How to reproduce the official course of yolov5 gracefully (II) -- Mark and train your own data set