当前位置:网站首页>Flex 布局
Flex 布局
2022-07-25 15:23:00 【꧁小ۣۖิ鸽ۣۖิ子ۣۖิ꧂】
布局的传统解决方案,基于盒状模型,依赖 display 属性 + position 属性 + float 属性。
它对于那些特殊布局非常不方便,比如,垂直居中就不容易实现。2009 年,W3C 提出了一种新的方案----Flex 布局,可以简便、完整、响应式地实现各种页面布局。
目前,它已经得到了所有浏览器的支持,这意味着,现在就能很安全地使用这项功能
一、Flex 布局是什么?
Flex 是 Flexible Box 的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性。任何一个容器都可以指定为 Flex 布局。
.box{
display: flex;
}
行内元素也可以使用 Flex 布局。
.box{
display: inline-flex;
}
Webkit 内核的浏览器,必须加上-webkit 前缀。
.box{
display: -webkit-flex; /* Safari */
display: flex;
}
设置了 Flex 布局之后,子元素的 float、clear 和 vertical-align 失效;
二、基本概念
采用 Flex 布局的元素,称为 Flex 容器(flex container),简称"容器"。
它的所有子元素自动成为容器成员,称为 Flex 项目(flex item),简称"项目"。
容器默认存在两根轴:水平主轴(main axis)和垂直的交叉轴。主轴的开始位置(与边框的交叉点)叫做 main start,结束位置叫做 main end;交叉轴的开始位置叫 cross start,结束位置叫 cross end。
项目默认沿主轴排列。单个项目占据的主轴空间叫做 main size,占据的交叉轴的空间叫做 cross size。
边栏推荐
猜你喜欢

spark分区算子partitionBy、coalesce、repartition

记一次Spark foreachPartition导致OOM

Implementation of asynchronous FIFO

NPM's nexus private server e401 E500 error handling record

JS 同步、异步,宏任务、微任务概述

分布式原理 - 什么是分布式系统

获取键盘按下的键位对应ask码

Spark SQL null value, Nan judgment and processing

为什么PrepareStatement性能更好更安全?

ML - Speech - advanced speech model
随机推荐
MySQL installation and configuration super detailed tutorial and simple database and table building method
打开虚拟机时出现VMware Workstation 未能启动 VMware Authorization Service
Spark AQE
ML - 语音 - 语音处理介绍
分布式原理 - 什么是分布式系统
ML - 语音 - 深度神经网络模型
Application of C language array in Sanzi chess -- prototype of Queen n problem
分布式 | 实战:将业务从 MyCAT 平滑迁移到 dble
Record a redis timeout
JVM dynamic bytecode technology details
Understanding the execution order of T-SQL query from the execution order of join on and where
数据系统分区设计 - 分区与二级索引
图论及概念
数据系统分区设计 - 分区再平衡(rebalancing)
wait()和sleep()的区别理解
My creation anniversary
Redis elimination strategy list
Yan required executor memory is above the max threshold (8192mb) of this cluster!
Vscode plugin collection
ML - natural language processing - Basics