Skip to content

Scroll-Snap Testimonial Slider

Horizontally scrolling testimonial cards using CSS scroll snap, with star ratings, avatars and accessible previous and next buttons.

Also known as: testimonial carousel, customer reviews slider, review cards carousel, quote slider

Scroll-Snap Testimonial Slider live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A horizontally scrolling testimonial slider built with native CSS scroll snap and a few lines of vanilla JavaScript for the previous and next buttons. Warm serif quote cards with star ratings and initials avatars make it a good fit for landing pages, pricing pages and case-study sections.

How it works

The root section.ts-slider holds a .ts-head with the heading and the .ts-controls buttons, followed by the ul.ts-track list. Each li.ts-slide contains a figure.ts-card with a .ts-stars rating, a blockquote.ts-quote and a figcaption.ts-author with a .ts-avatar, .ts-name and .ts-role.

The track is a CSS grid with grid-auto-flow: column, so slides line up in one row and overflow horizontally. scroll-snap-type: x mandatory on the track and scroll-snap-align: start on every slide make each swipe, trackpad gesture or arrow-key scroll settle on a card edge. The column width is calculated from --ts-per-view and --ts-gap: a little more than one card on phones, two from 700px and three from 1024px.

On DOMContentLoaded the script initializes every .ts-slider, reveals the hidden .ts-controls and listens for click on .ts-prev and .ts-next. Each click calls scrollBy() with the width of one slide plus the gap. A scroll listener, throttled with requestAnimationFrame, disables the previous button at the start and the next button at the end. Without JavaScript the buttons stay hidden and the track still scrolls and snaps natively.

Customization

  • --ts-per-view on .ts-slider: how many cards are visible; it is set to 2 and 3 in the 700px and 1024px media queries, and fractional values such as 1.15 show a peek of the next card.
  • --ts-gap: space between cards, also used in the column width calculation.
  • --ts-accent: the kicker text, avatar background, decorative quote mark, scrollbar and focus outline.
  • --ts-bg, --ts-card and --ts-dark: section background, light card and dark card colors.
  • Add .ts-card--dark to any figure.ts-card to switch it to the dark brown style.
  • --ts-radius: corner radius of the cards; the bottom-left corner stays nearly square on purpose.
  • Wrap the last star in .ts-star-off and update the aria-label on .ts-stars to show a 4-star rating.

Use cases

  • Landing pages: warm serif quote cards with star ratings build trust near the call to action
  • Pricing pages: customers' words sit under the plans to ease buying doubts
  • Case-study sections: initials avatars identify each speaker clearly without needing any photos
  • Mobile sites: scroll snap makes swiping smooth, with previous and next buttons for desktop users

Accessibility

The section is labelled by its heading and has aria-roledescription="carousel". Slides stay a real list, so screen readers announce the number of testimonials. The track has tabindex="0" and an aria-label, so keyboard users can focus it and scroll with the arrow keys. The buttons have aria-label and aria-controls, become disabled at the ends, and focus moves to the other button before one is disabled. Ratings use role="img" with a text label instead of reading out star characters, and avatars are aria-hidden. With prefers-reduced-motion: reduce scrolling jumps instead of animating. Every interactive element has a visible :focus-visible outline.

Usage notes

For several sliders on one page, give each .ts-track a unique id and update aria-controls on its buttons. The quote text uses a serif stack; swap the font-family on .ts-slider for your brand font.

Scroll-Snap Testimonial Slider at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
None
Layout
Responsive, works on mobile
Category
Testimonials
License
Free for personal and commercial use

Questions about this template

Can I use the Scroll-Snap Testimonial Slider 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?

There is nothing to install. 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

No dependencies. Pure HTML, CSS and JavaScript.

Scroll-Snap Testimonial Slider – free Pure CSS testimonial template
Scroll-Snap Testimonial Slider · free Pure CSS testimonial template

More Testimonials

Testimonial with Large Portrait Photo – free Tailwind CSS testimonial template

Testimonial with Large Portrait Photo

Featured Tailwind CSS testimonial with a large customer portrait, offset frame, serif quote, star rating and result metrics.

Single Testimonial with Large Quote – free WordPress testimonial template

Single Testimonial with Large Quote

A single testimonial for the block editor with a large centered customer quote, round portrait, name, role and company wordmark on a deep navy background.

Testimonial Cards with Avatars – free WordPress testimonial template

Testimonial Cards with Avatars

Testimonial cards for the block editor: three customer reviews with five-star ratings, round portrait avatars, names and roles on a warm light background.

Customer Testimonials Section for Shopify – free Shopify testimonial template

Customer Testimonials Section for Shopify

A Shopify section for customer quotes with star ratings, avatars and linked products, shown as a grid or a scrolling row with previous and next buttons.

Testimonial Carousel – free Bootstrap 5 testimonial template

Testimonial Carousel

Bootstrap 5 testimonial carousel with serif quote cards, pill indicators, arrow buttons and an accessible pause control.