flex笔记代码







<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 550px;
height: 400px;
background-color: orange;
margin: 0 auto;
/* 1 开启flex 布局*/
display: flex;
/* 2 flex-direction 主轴方向 */
/* row; 默认 从左到右 */
/* row-reverse 主轴从右到左 */
/* column 主轴从上到下 */
/* column-reverse 主轴从下到上*/
/* flex-direction: column-reverse; */
/* 3 justify-content 对齐方式 */
/* flex-start 默认 */
/* flex-end 右对齐 */
/* center 居中对齐 */
/* space-between 两端对齐 */
/* space-around 两端距离小 中间距离相等 */
/* space-evenly 等分对齐 距离间距一样 */
/* justify-content:space-around; */
/* 4 align-items 在交叉轴 对齐方式 */
/* normal 默认 */
/* flex-start */
/* flex-end 一行 底部对齐*/
/* center 居中对齐 */
/* baseline 文本基线对齐 以第一行为准 */
/* align-items: baseline; */
/* 5 flex-wrap 是否换行*/
/* wrap 换行 */
/* flex-wrap: wrap; */
/* 6 flex-flow 缩写属性 flex-direction flex-wrap*/
/* flex-flow: row wrap;
justify-content: space-evenly; */
/* 7 align-content 在 交叉轴 上的对齐方式(多行) */
/* flex-start */
/* flex-end */
/* center */
/* space-around */
/* space-between */
/* align-content: space-evenly; */
align-items: center;
}
.item{
width: 100px;
height: 100px;
line-height: 100px;
color: #fff;
text-align: center;
}
.item1{
background-color: #f00;
/* order:10; */
}
.item2{
background-color: #0f0;
/* order:6; */
height: 150px;
}
.item3{
background-color: #00f;
align-self: flex-end;
/* order:100; */
}
</style>
</head>
<body>
<div class="box">
<div class="item item1">item1</div>
<div class="item item2">item2</div>
<div class="item item3">item3</div>
</div>
</body>
</html>
我是Eric,手机号是13522679763

浙公网安备 33010602011771号