bottom
Example
.toast {
position: fixed;
bottom: 16px;
}.toast {
position: fixed;
bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}Adding the safe area inset keeps the toast above the home indicator on phones with no physical buttons.
Common mistakes
- A fixed bottom bar hides behind the phone's home indicator.
- The last item on the page is covered by a fixed footer.
Key points
- Fixed bottom bars add
env(safe-area-inset-bottom)so they clear the home indicator. - Elements using
bottomhave apositionother than 'static'. - Page content gets enough bottom padding so a fixed bar doesn't cover it.
Interview questions
Why is bottom: 0 not working?
The element needs a position other than 'static', and for 'absolute' its containing block must be tall enough.
What is the difference between bottom and margin-bottom?
bottom moves a positioned element without affecting others, while margin-bottom changes spacing in normal flow.
What is the logical version of bottom?
inset-block-end, which follows the writing mode.