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>

相关推荐
无心使然4 分钟前
Openlayers调用ArcGis要素服务之一 ——要素查询 (/query)
前端·javascript·数据可视化
ZC跨境爬虫4 分钟前
跟着 MDN 学 HTML day_1:(全套原生Input+表单结构拆解)
前端·css·ui·html
焰火19999 分钟前
[前端]单文件上传组件
前端·vue.js
kyriewen1110 分钟前
Next.js部署:从本地跑得欢,到线上飞得稳
开发语言·前端·javascript·科技·react.js·前端框架·ecmascript
慕容卡卡15 分钟前
Claude 使用神器(web页面)--CloudCLI UI
java·开发语言·前端·人工智能·ui·spring cloud
JarvanMo25 分钟前
搞懂这 5 个 AI 术语,你就超过了 90% 的人
前端·后端
IT_陈寒30 分钟前
Vite的HMR怎么突然失效了?原来是我太年轻
前端·人工智能·后端
ZC跨境爬虫35 分钟前
Apple官网复刻第二阶段day_6:(统一页脚模块封装+CSS公共复用体系落地)
前端·css·ui·重构·html
恋猫de小郭38 分钟前
Flutter 凉了没?Flutter 2026 的未来行程和规划,一些有趣的变化
android·前端·flutter
Beginner x_u40 分钟前
前端手动实现大文件分片上传调度层:分片计算、并发上传与断点续传
前端·状态模式·断点续传·大文件分片上传