# bottom

> The `bottom` CSS property specifies the vertical offset of a positioned element.

## How do I stick an element to the bottom of the screen in CSS?

The property that sets the distance between the bottom edge of an element and the bottom edge of its containing block. With 'absolute' or 'fixed' `position` it places the element in its nearest positioned ancestor or the viewport, while with 'relative' it shifts it from its normal place.

- Topic: Positioning
- Type: property
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 1+, Safari iOS 1+

## Example

Wrong:

```css
.toast {
  position: fixed;
  bottom: 16px;
}
```

Right:

```css
.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 `bottom` have a `position` other 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.

## Related cards

- [position](https://wonderium.dev/css/position.md)
- [top](https://wonderium.dev/css/top.md)
- [env()](https://wonderium.dev/css/env.md)
- [inset](https://wonderium.dev/css/inset-property.md)
- [Viewport Units](https://wonderium.dev/css/viewport-units.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/bottom
- Last updated: 2026-11-25
