flex 未完成

This commit is contained in:
asd
2021-01-20 18:33:56 +08:00
parent b8df71627e
commit 6dacee749f
17 changed files with 382 additions and 14 deletions

55
csspress/demo2/flex.html Normal file
View File

@@ -0,0 +1,55 @@
<!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>
*{
margin:0;
padding: 0;
}
.box{
height: 500px;
background:gold ;
display: flex;
/* flex-direction: column; */
/* align-items: flex-start; */
align-items: baseline;
/* align-items: center; */
/* align-items: flex-end; */
/* flex-direction: row; */
/* justify-content:center; */
/* justify-content:space-around; */
/* justify-content: space-between; */
/* flex-wrap: wrap; */
}
.left{
width: 120px;
height: 120px;
background: pink;
}
.right{
width: 120px;
height: 120px;
background: gray;
}
</style>
</head>
<body>
<div class="box">
<div class="left">萤草</div>
<!-- <div class="left"></div>
<div class="left"></div> -->
<div class="right">青行灯</div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
</div>
</body>
</html>

103
csspress/demo2/flex2.html Normal file
View File

@@ -0,0 +1,103 @@
<!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>
*{
margin: 0;
padding:0;
}
.box{
display:flex
}
.one{
height: 200px;
border: 1px solid red;
flex:1;
}
.two{
height: 200px;
border: 1px solid blue;
flex:1;
}
.box1{
width: 800px;
height: 400px;
background: skyblue;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.left{
width:20%;
height: 200px;
background: pink;
}
.right{
width:70%;
height: 200px;
background: silver;
}
.left1{
width:200px;
height: 200px;
background: pink;
}
.right1{
width:200px;
height: 200px;
background: silver;
}
.box2{
justify-content: center;
align-items: center;
}
html,
body {
height: 100%
}
.main {
display: flex;
height: 100%;
justify-content: center;
align-items: center;
border: 1px solid gray;
}
.box4 {
width: 300px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="box">
<div class="one"></div>
<div class="two"></div>
<div></div>
</div>
<div class="box1">
<div class="left"></div>
<div class="right"></div>
</div>
<div class="box1 box2">
<div class="left1"></div>
<div class="right1"></div>
</div>
<div class="main">
<div class="box4">未知高度上下左右居中</div>
</div>
</body>
</html>