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>

相关推荐
2601_958492551 小时前
Optimizing Engagement with Freehead Skate - HTML5 Game - Construct 3
前端·html·html5
茉莉玫瑰花茶1 小时前
工作流的常见模式 [ 1 ]
java·服务器·前端
zhangxingchao2 小时前
AI应用开发六:企业知识库
前端·人工智能·后端
山峰哥2 小时前
SQL慢查询调优实战:从全表扫描到索引覆盖的完整复盘
前端·数据库·sql·性能优化
红尘散仙3 小时前
一个 `#[uniffi::export]`,把 Rust 接进 React Native
前端·后端·rust
moshuying3 小时前
AI Coding 最大的 token 黑洞,可能根本不是 prompt
前端
红尘散仙3 小时前
一行 `#[specta::specta]`,让 Tauri IPC 有类型
前端·后端·rust
lichenyang4533 小时前
HarmonyOS HMRouter 接入记录:从普通 Tab Demo 到路由跳转
前端
木斯佳3 小时前
前端八股文面经大全:腾讯WXG暑期前端一面(2026-05-15)·面经深度解析
前端·面试·笔试