惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
Y
Y Combinator Blog
D
DataBreaches.Net
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
H
Help Net Security
GbyAI
GbyAI
C
Check Point Blog
L
LangChain Blog
小众软件
小众软件
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
G
Google Developers Blog
月光博客
月光博客
V
V2EX
M
MIT News - Artificial intelligence
博客园 - 叶小钗

博客园 - androllen

Python yield 关键词 PDF 构成 桌面客户端的主要类型和技术方案 Python 压缩转义 异步删除嵌套文件夹及文件 数据结构 二叉树遍历 数据结构 线性表 JS 字符串转换为函数体 VSCode 配置内部Python项目 缺少模块ModuleNotFoundError C# 基础知识 算法-数列 算法-排序算法 C# 设计模式-简单工厂模式 C# 设计模式 C# Utils .Net 异步与同步 WPF StreamGeometry Vue 打开窗口输出文件路径 CSS Flexbox layout 2
CSS Flexbox layout 1
androllen · 2022-10-05 · via 博客园 - androllen

一直都不太清楚水平和垂直,想了好久怎么才能更好的形容呢?突然想到了这杆称,可以很好的形容主副轴

蓝主轴(水平):好比称杆
红副轴(垂直):好比称托,可以放秤砣(盒子)(或者想象成算盘)

开局给你一个 flex 看你如何布局 Hello World~

display: flex

flex 布局有主轴和副轴

# 主轴 对齐方式
justify-content: space-between;
justify-content: space-around;
justify-content: space-evenly;
justify-content: flex-start;
justify-content: flex-end;
justify-content: center;
#使用margin属性控制水平对齐
margin-left: auto;
# 副轴 对齐方式
align-items: space-between;
align-items: space-around;
align-items: space-evenly;
align-items: flex-start;
align-items: flex-end;
align-items: center;
# 子元素覆盖对齐方式
align-self: flex-end;

更改 主轴副轴

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

设置 flex 子元素折行

flex-wrap: wrap;

空间占比

# 根据盒子内容自动改变
flex-basis: auto;
# 
min-width: 250px;
# 容器中剩余空间的分配
flex-grow
# 仅在默认宽度之和大于容器的时候才会发生收缩
flex-shrink

实战

弹性源码


弹性布局源码