flexbox弹性布局
来源:互联网 发布:大数据魔镜破解版 编辑:程序博客网 时间:2024/05/17 17:59
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><style type="text/css"> /*兼容写法*/ /*display:-webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex;*/ *{ margin: 0; padding: 0; }</style><body><style type="text/css"> /*单项目*/ .box{ width: 100%; height: 80px; border: 1px solid #000; display: flex;/*必须属性*/ justify-content: space-between;/*设置项目的对齐方式,就能实水平方式对齐。*/ align-items: center;/*设置交叉轴对齐方式,可以垂直对齐。*/ } .item{ width: 50px; height: 50px; border-radius: 50px; background-color: red; } /*双项目*/ .box1{ width: 100%; height: 120px; border: 1px solid #000; display: flex;/*必须属性*/ justify-content: center;/*设置项目的对齐方式,就能实水平方式对齐。*/ align-items: center;/*设置交叉轴对齐方式,可以垂直对齐。*/ flex-direction: column; } .item1{ width: 50px; height: 50px; border-radius: 50px; background-color: red; } .item1:nth-child(2) { align-self: flex-end;/*某个弹性对象的对齐方式*/ } .box2 { width: 100%; height: 120px; border: 1px solid #000; display: flex; flex-wrap: wrap; align-content: space-between; /*flex-wrap: wrap;*/ /*超出是否换行*/ } .column2 { flex-basis: 100%;/*初始化宽度*/ display: flex; justify-content: space-between; } .item2{ width: 50px; height: 50px; border-radius: 50px; background-color: red; }</style><!-- --------------------骰子的布局----------------- --><!-- 单项目 --><div class="box"> <span class="item"></span></div><!-- 双项目 --><div class="box1"> <span class="item1"></span> <span class="item1"></span></div><!-- 四项目 --><div class="box2"> <div class="column2"> <span class="item2"></span> <span class="item2"></span> </div> <div class="column2"> <span class="item2"></span> <span class="item2"></span> </div></div><!-- ----------------------网格布局------------------- --><style type="text/css"> body{ /*overflow: hidden;*/ } .Grid{ display: flex; justify-content:center; } .Grid-cell{ border: 1px solid red; height: 80px; flex: 1; display: flex; justify-content: center; align-items: center; /*flex 属性是 flex-grow:元素的宽度为其他元素的多少倍宽、flex-shrink:元素收缩到其他元素的多少分之几 和 flex-basis:初始化宽度, 属性的简写属性,让所有弹性盒模型对象的子元素都有相同的长度,忽略它们内部的内容*/ } .Grid-cell.u-full { flex: 0 0 100%; } .Grid-cell.u-1of2 { flex: 0 0 50%; } .Grid-cell.u-1of3 { flex: 0 0 33.3333%; } .Grid-cell.u-1of4 { flex: 0 0 25%; } .item{ width: 50px; height: 50px; border-radius: 50px; background-color: red; }</style><div class="Grid"> <div class="Grid-cell u-1of4"> <span class="item"></span> </div> <div class="Grid-cell">...</div> <div class="Grid-cell">...</div></div></body></html>
0 0
- flexbox弹性盒子布局
- RN-flexbox(弹性布局)
- flexbox弹性布局
- Flexbox 弹性盒子布局
- Flexbox弹性盒子布局
- 弹性布局FlexBox
- flexbox弹性布局
- CSS3--弹性布局flexbox
- React Native 弹性布局FlexBox
- flexbox 弹性盒布局和布局原理
- flexbox 弹性盒布局和布局原理
- CSS弹性盒子Flexbox布局详解
- CSS弹性盒子Flexbox布局详解
- CSS弹性盒子Flexbox布局详解
- 一分钟理解Flexbox弹性布局
- css3 flexbox layout(弹性布局)完全解析
- flexbox-CSS3弹性盒模型flexbox布局完整版教程
- flexbox-CSS3弹性盒模型flexbox布局完整版教程
- 经典面试题(一)
- opengl tessellation 举例
- 基于《PythonCookbook》的学习(6)——以不区分大小写的方式对文本做查找和替换
- Bridge模式
- C++类中的static数据成员,static成员函数
- flexbox弹性布局
- Blind Return Oriented Programming(BROP)Attack攻击原理
- Tree-----根据给定的数字找路径(112. Path Sum)
- Flex 布局:实例篇
- 编程语言简单分类
- Unity Mesh生成图形
- 如何向iphone手机网易云音乐添加本地音乐
- 关于unity3D教材
- jsp页面引用的相对路径和绝对路径问题