Skip to content

Free Shipping Announcement Bar

Bootstrap 5 announcement bar that rotates free shipping, returns and coupon messages with pause, arrows, a progress line and a dismiss button.

Also known as: announcement bar, top banner rotating messages, shipping promo bar, promo ticker bar, sitewide notice bar

Free Shipping Announcement Bar live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A Bootstrap 5 free shipping announcement bar that rotates short promo messages above your store header, with pause, previous, next and close buttons. Use it for free shipping thresholds, return policies and discount codes on e-commerce sites.

How it works

The root .fsb-root holds the aside.fsb-bar and, for the demo only, a store navbar and hero. Inside the bar, .fsb-viewport contains one p.fsb-msg per message. The viewport is a CSS grid and every message sits in the same grid cell, so the bar always keeps the height of the longest message and the page below never jumps. Inactive messages carry the hidden attribute, which the CSS turns into visibility: hidden.

On DOMContentLoaded the script starts a timer for every .fsb-root. Every data-fsb-interval milliseconds it moves is-active to the next message, which slides in with the fsb-in keyframes, and restarts the thin .fsb-progress line at the bottom of the bar. The timer stops while the pointer or keyboard focus is inside the bar and resumes when they leave. .fsb-prev and .fsb-next step through the messages manually, and .fsb-pause stops the rotation until it is pressed again.

.fsb-close collapses the bar with a short height transition, hides it and stores the dismissal in sessionStorage under the data-fsb-key value, so the bar stays closed for the rest of the visit. When storage is blocked, the bar returns on the next page load.

Customization

  • --fsb-bg, --fsb-text and --fsb-accent on .fsb-root in style.css: recolor the bar, its text, the icons, links and the progress line.
  • --fsb-height on .fsb-root: set the minimum height of the bar.
  • data-fsb-interval="5000" on .fsb-root: change how long each message stays visible, in milliseconds.
  • data-fsb-key on .fsb-root: use a new key (for example per campaign) so visitors who closed an older bar see the new one.
  • Add or remove p.fsb-msg elements in .fsb-viewport: the script counts them automatically; give every message except the first the hidden attribute.
  • .fsb-code inside a message: highlights a coupon code with a dashed accent border.
  • Remove the .fsb-demo-nav and .fsb-demo-hero blocks and --fsb-demo-bg: they only show the bar in context.

Use cases

  • Online stores: rotating messages promote free shipping, returns and coupon codes
  • Sale campaigns: a progress line shows when the next message appears
  • Site-wide notices: pause and arrow controls let visitors read at their own pace
  • Ecommerce headers: a dismiss button hides the bar once seen

Accessibility

The bar is an aside labelled "Store announcements". Automatic rotation keeps aria-live="off" on .fsb-viewport, so screen readers are not interrupted every few seconds; manual navigation and the paused state switch it to polite. The pause button uses aria-pressed and an aria-label that changes between "Pause announcements" and "Play announcements", which satisfies the WCAG requirement to stop moving content. All controls are real buttons with visible focus outlines. After closing, focus moves to the next focusable element on the page. With prefers-reduced-motion: reduce the slide-in, progress line and collapse animations are turned off.

Usage notes

Requires Bootstrap 5 and Bootstrap Icons. Place .fsb-root (without the demo blocks) at the top of the body. Several bars work independently. Below the sm breakpoint only the pause and close buttons are shown.

Free Shipping Announcement Bar at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Promo Banners
License
Free for personal and commercial use

Questions about this template

Can I use the Free Shipping Announcement Bar code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Free Shipping Announcement Bar – free Bootstrap 5 promo banner template
Free Shipping Announcement Bar · free Bootstrap 5 promo banner template

More Promo Banners

Coupon Ticket – free Pure CSS promo banner template

Coupon Ticket

Ticket-style discount coupon with a striped stub, dashed perforation with notches and a copy code button with clipboard fallback and live feedback.

Promo Banner with Countdown – free Tailwind CSS promo banner template

Promo Banner with Countdown

Dark Tailwind CSS sale banner with a live countdown timer, discount code, call-to-action button and a dismiss control.