新旧弹性盒 样式
版本日期:17/09/20
/**弹性父元素属性**/ .flex { display: box; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; } /*flex 属性用于指定弹性子元素如何分配空间。*/ .flex .f1 { -webkit-box-flex: 1; -moz-box-flex: 1; -webkit-flex: 1; -ms-flex: 1; flex: 1; } .flex .f2 { -webkit-box-flex: 2; -moz-box-flex: 2; -webkit-flex: 2; -ms-flex: 2; flex: 2; } .flex .f3 {flex:3;} /*flex-direction 顺序指定了弹性子元素在父容器中的位置。*/ .fd-r {flex-direction: row;} .fd-rr {flex-direction: row-reverse;} .fd-c { -webkit-box-orient: vertical; -webkit-flex-direction: column; -moz-flex-direction: column; -ms-flex-direction: column; -o-flex-direction: column; flex-direction: column; } .fd-cr {flex-direction: column-reverse;} /*内容对齐(justify-content)属性应用在弹性容器上,把弹性项沿着弹性容器的主轴线(main axis)对齐。*/ .jc-fs {justify-content: flex-start;} .jc-fe {justify-content: flex-end;} .jc-c { -webkit-box-pack: center; -webkit-justify-content: center; -moz-justify-content: center; -ms-justify-content: center; -o-justify-content: center; justify-content: center; } .jc-sb {justify-content: space-between;} .jc-sa {justify-content: space-around;} /*align-items 设置或检索弹性盒子元素在侧轴(纵轴)方向上的对齐方式。*/ .ai-fs {align-items: flex-start;} .ai-fe {align-items: flex-end;} .ai-c { -webkit-box-align: center; -webkit-align-items: center; -moz-align-items: center; -ms-align-items: center; -o-align-items: center; align-items: center; } .ai-b {align-items: baseline;} .ai-s {align-items: stretch;} /*flex-wrap 属性用于指定弹性盒子的子元素换行方式。*/ .fw-nw {flex-wrap:nowrap;} /*默认, 弹性容器为单行。该情况下弹性子项可能会溢出容器。*/ .fw-w {flex-wrap:wrap ;} .fw-nw {flex-wrap:wrap-reverse;} /*反转 wrap 排列。*/ /*align-content 属性用于修改 flex-wrap 属性的行为。类似于 align-items, 但它不是设置弹性子元素的对齐,而是设置各个行的对齐。*/ .ac-s {align-content: stretch;} .ac-fs {align-content: flex-start;} .ac-fe {align-content: flex-end;} .ac-c {align-content: center;} .ac-sb {align-content: space-between;} .ac-sa {align-content: space-around;} /*排序 order <integer>:用整数值来定义排列顺序,数值小的排在前面。可以为负值。*/ .flex .order-1 {order: 1;} .flex .order-2 {order: 2;} .flex .order-3 {order: 3;} /*align-self 属性用于设置弹性元素自身在侧轴(纵轴)方向上的对齐方式。*/ .as-a {align-self:auto;} .as-fs {align-self:flex-start;} .as-fe {align-self:flex-end;} .as-c {align-self:center;} .as-b {align-self:baseline;} .as-s {align-self:stretch;} .margin-auto{ margin: auto; }
分类:
前端
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律