-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfix-footer-page-bottom-absolute.html
60 lines (52 loc) · 1.12 KB
/
fix-footer-page-bottom-absolute.html
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
60
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>借助absolute把Footer固定在页面底部</title>
<style>
* {
margin: 0px;
padding: 0px;
}
html,
body {
width: 100%;
height: 100%;
}
.main {
position: relative;
min-height: 100%;
}
header {
width: 100%;
position: sticky;
top: 0;
background-color: #0b84fd;
padding: 20px 0px;
text-align: center;
}
.content {
/*高度可由内容撑开*/
width: 100%;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
background-color: #666;
}
</style>
</head>
<body>
<div class="main">
<header>header</header>
<div class="content">
content
</div>
<footer>2011-2019 © bajins.com</footer>
</div>
</body>
</html>