flex布局

demo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>flex布局example</title>
</head>
<style>
*{
	margin:0;
	padding: 0;
}
#wrap{
  	display: flex;
  	//justify-content: space-between;
  	//justify-content: flex-end;
  	//align-items:center;
  	flex-direction: column;
  	margin:0 auto;
  	width:1000px;
  	height: 300px;
  	border:1px solid red;
}
header,footer{
	height:40px;
	background: #f60;
}
.main{
	display: flex;
	height:160px;
	margin:20px 0;
}
.list{
	margin-right:20px;
	background: yellow;
}
.li1{
	width:100px;
}
.li2{
	flex:1;
}
.main #l3{
	width:40px;
	margin-right:0;
}
</style>
<body>
<div id="wrap">
	<header>头部</header>
	<div class="main">
		<div class="list li1">1</div>
		<div class="list li2">2</div>
		<div class="list" id="l3">3</div>
	</div>
	<footer>脚部</footer>
</div>

</body>
</html>

更多-more