Skip to content

Commit 808020a

Browse files
authored
Merge pull request #3 from brianhawthorne/main
⚓ Make footer sticky
2 parents 9333dc1 + e9ceba2 commit 808020a

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

css/footer.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1+
html,
2+
body {
3+
height: 100%;
4+
}
5+
body {
6+
display: flex;
7+
flex-direction: column;
8+
}
9+
10+
.article.content {
11+
/* Override 100vh from myst-theme:styles/typography.css so content div
12+
* doesn't push the footer offscreen.
13+
*/
14+
min-height: 0vh;
15+
flex-grow: 1;
16+
flex-shrink: 0;
17+
flex-basis: auto;
18+
}
19+
120
.footer {
21+
/* Make footer "sticky" to page bottom (also the above flex rules), per
22+
* the flexbox strategy described here:
23+
* https://css-tricks.com/couple-takes-sticky-footer/#aa-there-is-flexbox
24+
* and here:
25+
* https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
26+
* This solution does not require hardcoding a fixed footer height in the
27+
* style rules.
28+
*/
29+
flex-shrink: 0;
230
background: #013243;
331
color: white;
432
padding-left: 2rem;

myst.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ version: 1
33
project:
44
id: ee007168-b9a5-4dba-8823-1639a4aeb956
55
title: Hello Landing Pages
6+
abbreviations:
7+
CSS: Cascading Style Sheet
68
toc:
79
- file: index.md
10+
- file: other-page.md
811
site:
912
template: book-theme
1013
title: Hello Landing Pages

other-page.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Other Page
2+
3+
This page contains some content. It demonstrates the use of custom CSS to implement a sticky footer.

0 commit comments

Comments
 (0)