flex 弹性布局 笔记

<style>

/*

flex-direction (即项目的排列方向)

flex-wrap (换行)

flex-flow ( flex-direction属性和flex-wrap属性的简写形式)

justify-content (项目的对齐方向)主轴

align-items (项目的对齐方向)测轴

align-content ( 多根轴线的对齐方式)

flex-direction: row | row-reverse | column | column-reverse;

flex-direction属性决定主轴的方向(即项目的排列方向)。

row(默认值):主轴为水平方向,起点在左端。

row-reverse:主轴为水平方向,起点在右端。

column:主轴为垂直方向,起点在上沿。

column-reverse:主轴为垂直方向,起点在下沿。

flex-wrap: nowrap | wrap | wrap-reverse;项目都排在一条线(又称"轴线")上。flex-wrap属性定义,如果一条轴线排不下,如何换行

flex-flow属性是flex-direction属性和flex-wrap属性的简写形式

justify-content属性定义了项目在主轴上的对齐方式 (项目的对齐方向)。

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

align-items属性定义项目在交叉轴上如何对齐 (项目的对齐方向)。

align-items: flex-start | flex-end | center | baseline | stretch;

align-content属性定义了多根轴线的对齐方式。如果项目只有一根轴线,该属性不起作用

align-content: flex-start | flex-end | center | space-between | space-around | stretch;

*/

.container {

height: 200px;

background-color: red;

display:flex;

flex-direction:row;

justify-content:flex-end;

/* align-items:stretch ; */

align-content:center;

}

*{ border:black 1px solid; }

.item { background:blue;

color:white;

width: 50px;

/* height: 50px;*/

}

</style>

</head>

<body>

<div class="container">

<div class="item">Item 1</div>

<div class="item">Item 2</div>

<div class="item">Item 3</div>

</div>

相关推荐
2分钟速写快排4 小时前
孔乙己的茴字有多少种写法?|AI 对话实时通信的三种实现
前端·javascript·github
Penge6666 小时前
JavaScript:BOM 详解
前端
Penge6666 小时前
Vite vs Webpack:前端构建工具原理与实战
前端
Penge6666 小时前
前端包管理工具:npm、Yarn、pnpm 快速入门
前端
Penge6667 小时前
Sass 了解
前端
Penge6667 小时前
Webpack 打包从 0 到 1 实战笔记
前端
Penge6667 小时前
Webpack 入门:是什么、为什么需要、怎么使用?
前端
Penge6668 小时前
Ant Design(Antd)了解
前端
wangruofeng8 小时前
同一行代码,百种渲染:Asuka、React Native 与 Flutter 跨平台渲染机制深度拆解
前端·github
Penge6668 小时前
JavaScript 核心语法速通
前端