Skip to content

Commit 8e19e3e

Browse files
committed
correcting sticky footer example
1 parent e39d727 commit 8e19e3e

File tree

2 files changed

+55
-43
lines changed

2 files changed

+55
-43
lines changed

css-cookbook/sticky-footer-flexbox--download.html

+18-20
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,44 @@
1010

1111

1212
<style>
13-
html {
14-
height:100%;
15-
box-sizing: border-box;
16-
}
17-
13+
html,
1814
body {
15+
box-sizing: border-box;
1916
height: 100%;
20-
background-color: #fff;
21-
color: #333;
22-
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
2317
padding: 0;
2418
margin: 0;
2519
}
2620

27-
* {
28-
box-sizing: inherit;
29-
}
30-
3121
.wrapper {
22+
box-sizing: border-box;
3223
min-height: 100%;
3324
display: flex;
3425
flex-direction: column;
3526
}
3627

3728
.page-header,
3829
.page-footer {
39-
background-color: rgb(75, 70, 74);
40-
color: #fff;
41-
padding: 20px;
42-
flex-shrink: 0;
30+
flex-grow: 0;
4331
}
4432

4533
.page-body {
46-
padding: 20px;
4734
flex-grow: 1;
4835
}
4936

50-
.preview {
51-
height: 400px;
52-
overflow: auto;
37+
/* For demonstration only, not part of the recipe */
38+
body {
39+
background-color: #fff;
40+
color: #333;
41+
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
42+
}
43+
.page-header,
44+
.page-footer {
45+
background-color: rgb(75, 70, 74);
46+
color: #fff;
47+
padding: 20px;
48+
}
49+
.page-body {
50+
padding: 20px;
5351
}
5452
</style>
5553

css-cookbook/sticky-footer-flexbox.html

+37-23
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,60 @@
1010
<link rel="stylesheet" href="styles.css">
1111

1212
<style>
13-
html {
14-
height:100%;
15-
box-sizing: border-box;
16-
}
17-
1813
* {
19-
box-sizing: inherit;
14+
box-sizing: border-box;
2015
}
21-
16+
html,
2217
body {
18+
box-sizing: border-box;
2319
height: 100%;
20+
padding: 0;
21+
margin: 0;
2422
}
2523

2624
.page-header,
2725
.page-footer {
2826
background-color: rgb(75, 70, 74);
2927
color: #fff;
3028
padding: 20px;
31-
flex-shrink: 0;
3229
}
3330

3431
.page-body {
3532
padding: 20px;
36-
flex-grow: 1;
3733
}
3834

3935
.preview {
40-
height: 100%;
36+
height: 400px;
37+
overflow: auto;
38+
}
39+
40+
.playable-css {
41+
min-height: 420px;
42+
overflow: auto;
43+
}
44+
45+
.playable-html {
46+
min-height: 160px;
4147
overflow: auto;
4248
}
4349
</style>
4450

4551
<style class="editable">
52+
html, body {
53+
box-sizing: border-box;
54+
height: 100%;
55+
padding: 0;
56+
margin: 0;
57+
}
4658
.wrapper {
59+
box-sizing: border-box;
4760
min-height: 100%;
4861
display: flex;
4962
flex-direction: column;
5063
}
51-
52-
.page-header,
53-
.page-footer {
54-
flex-shrink: 0;
64+
.page-header, .page-footer {
65+
flex-grow: 0;
5566
}
56-
5767
.page-body {
5868
flex-grow: 1;
5969
}
@@ -72,31 +82,35 @@
7282
</div>
7383
</section>
7484

75-
<textarea class="playable playable-css">
85+
<textarea class="playable playable-css">
86+
html, body {
87+
box-sizing: border-box;
88+
height: 100%;
89+
padding: 0;
90+
margin: 0;
91+
}
7692
.wrapper {
93+
box-sizing: border-box;
7794
min-height: 100%;
7895
display: flex;
7996
flex-direction: column;
8097
}
81-
82-
.page-header,
83-
.page-footer {
84-
flex-shrink: 0;
98+
.page-header, .page-footer {
99+
flex-grow: 0;
85100
}
86-
87101
.page-body {
88102
flex-grow: 1;
89103
}
90104
</textarea>
91105

92-
<textarea class="playable playable-html">
106+
<textarea class="playable playable-html">
93107
<div class="wrapper">
94108
<header class="page-header">This is the header</header>
95109
<main class="page-body">
96110
<p>Main page content here, add more if you want to see the footer push down.</p>
97111
</main>
98112
<footer class="page-footer">Sticky footer</footer>
99-
</div>
113+
</div>
100114
</textarea>
101115

102116
<div class="playable-buttons">

0 commit comments

Comments
 (0)