position footer to stay at bottom of screen flexbox
/* Use flex and set auto margin */
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
footer {
margin-top: auto;
}
position footer to stay at bottom of screen flexbox
/* Use flex and set auto margin */
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
footer {
margin-top: auto;
}
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; } /* Push following elements to the bottom */
a { margin-top: auto; } /* Push it and following elements to the bottom */
Show code snippet
Alternatively, you can make the element before the a grow to fill the available space:
p { flex-grow: 1; } /* Grow to fill available space */
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us