# Sticky Action Bar

> A bottom bar with a price and a buy button that stays in view while the page scrolls, safe-area aware.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: sticky bottom, checkout, mobile, call to action, safe area
- Live preview: https://copy-css.com/snippets/sticky-action-bar
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="action-page">
  <div class="action-page-content">
    <h3>Trail Runner</h3>
    <p>Light, grippy and made for long days on rough ground.</p>
    <p>Recycled mesh upper, foam midsole, 8 mm drop.</p>
    <p>Free returns within 30 days.</p>
  </div>
  <div class="action-bar">
    <span><b>$129</b> incl. tax</span>
    <a href="#">Add to cart</a>
  </div>
</div>
```

## CSS

```css
.action-page {
  background: #ffffff;
  color: #334155;
  font: 15px/1.5 system-ui, sans-serif;
}

.action-page-content {
  padding: 16px;
}

.action-page-content h3 {
  margin: 0 0 6px;
  color: #0f172a;
}

.action-page-content p {
  margin: 0 0 10px;
}

/* Sticks to the bottom of the screen (or scroll box) */
.action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #e2e8f0;
  background: #ffffffe6;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.action-bar b {
  color: #0f172a;
  font-size: 18px;
}

.action-bar a {
  padding: 10px 16px;
  border-radius: 10px;
  background: #16a34a;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.action-bar a:hover {
  background: #15803d;
}

.action-bar a:focus-visible {
  outline: 2px solid #15803d;
  outline-offset: 2px;
}
```

## Notes

- This CSS Sticky Action Bar is 57 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses backdrop filters, Flexbox, sticky positioning and keyboard focus styles.
- backdrop filters: Includes the -webkit- prefix for older Safari.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
