CSS Sticky Action Bar

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

  • sticky bottom
  • checkout
  • mobile
  • call to action
  • safe area
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
.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;
}

About this CSS Sticky Action Bar

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. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #ffffff
  • #334155
  • #0f172a
  • #e2e8f0
  • #ffffffe6
  • #16a34a
  • #15803d

How to use this sticky action bar

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .action-page class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback