flex布局详解

1.flex 布局  盒子都要加上  display: flex 属性   // Webkit 内核的浏览器,必须加上-webkit前缀
.box{
  display: flex;
}
-webkit
flex-direction   
row 
| row-reverse | column | column-reverse;
.box {
  flex-direction: row ; 子盒子 横向左到右顺序排列
}
.box {
  flex-direction:
row-reverse
; 子盒子 横向右到左顺序排列 

}
.box {
  flex-direction:
column 
}
.box {
  flex-direction:
column-
reverse
}
3. 默认情况下,项目都排在一条线(又称"轴线")上。flex-wrap属性定义,如果一条轴线排不下,如何换行    
flex-wrap
nowrap | wrap | wrap-reverse;
.box{
  flex-wrap: nowrap 默认不换行          | wrap  换行排满第一行 一次排列 | wrap-reverse; 换行 第一行不排满
}
4.  flex-flow属性是flex-direction属性和flex-wrap属性的简写形式,默认值为row nowrap

5.  justify-content属性定义了项目在主轴上的对齐方式
flex-flow
flex-direction
flex-wrap
row nowrap

justify-content
flex-start | flex-end | center | space-between | space-around

 


 6.   align-items属性定义项目在交叉轴上如何对齐。

.box {
  align-items: flex-start | flex-end | center | baseline | stretch;
}

 

 

flex布局 盒子 水平垂直居中   
。box{
     display: flex;
            align-items: center;
            justify-content: center;


posted @   小猴子会上树  阅读(132)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示