flex box how to fix to the bottom of the page code example
Example 1: position footer to stay at bottom of screen flexbox
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
footer {
margin-top: auto;
}
Example 2: css flex bottom
You can use auto margins
Prior to alignment via justify-content and align-self, any positive free space is distributed to auto margins in that dimension.
So you can use one of these (or both):
p { margin-bottom: auto; }
a { margin-top: auto; }
Show code snippet
Alternatively, you can make the element before the a grow to fill the available space:
p { flex-grow: 1; }