CARDS

Testimonial Card

A clean testimonial card with customer feedback, star rating and profile details. Copy the HTML and CSS for your own project.

β˜…β˜…β˜…β˜…β˜…

β€œThis component library helped us build our interface faster while keeping everything clean and consistent.”

SJ
Sarah Johnson Product Designer
HTML
<div class="testimonial-card">

  <div class="testimonial-rating">
    β˜…β˜…β˜…β˜…β˜…
  </div>

  <p class="testimonial-quote">
    β€œThis component library helped us build our interface
    faster while keeping everything clean and consistent.”
  </p>

  <div class="testimonial-user">

    <div class="testimonial-avatar">
      SJ
    </div>

    <div class="testimonial-info">
      <strong>Sarah Johnson</strong>
      <span>Product Designer</span>
    </div>

  </div>

</div>
CSS
.testimonial-card{
  width:100%;
  max-width:380px;
  padding:30px;
  background:#08111f;
  border:1px solid rgba(255,255,255,.10);
  border-radius:20px;
  color:#ffffff;
  box-shadow:0 18px 45px rgba(0,0,0,.28);
  transition:
    transform .3s ease,
    border-color .3s ease,
    box-shadow .3s ease;
}

.testimonial-card:hover{
  transform:translateY(-7px);
  border-color:rgba(34,211,238,.45);
  box-shadow:
    0 26px 55px rgba(0,0,0,.35),
    0 0 28px rgba(34,211,238,.12);
}

.testimonial-rating{
  margin-bottom:18px;
  color:#fbbf24;
  font-size:15px;
  letter-spacing:2px;
}

.testimonial-quote{
  margin:0 0 26px;
  color:#c7d2e5;
  font-size:15px;
  line-height:1.8;
}

.testimonial-user{
  display:flex;
  align-items:center;
  gap:14px;
  padding-top:20px;
  border-top:1px solid rgba(255,255,255,.08);
}

.testimonial-avatar{
  width:50px;
  height:50px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  border-radius:50%;
  background:linear-gradient(
    135deg,
    #22d3ee,
    #8b5cf6
  );
  color:#ffffff;
  font-size:15px;
  font-weight:800;
  box-shadow:0 0 20px rgba(139,92,246,.25);
}

.testimonial-info{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.testimonial-info strong{
  color:#ffffff;
  font-size:14px;
}

.testimonial-info span{
  color:#8fa4bd;
  font-size:12px;
}

How This Testimonial Card Works

This Testimonial Card uses a compact HTML structure and CSS styling to present a customer rating, review text, and user information in one reusable card. The published component does not use JavaScript, so its appearance and hover interaction are handled entirely with CSS.

The main .testimonial-card container uses width: 100% with max-width: 380px. This allows the card to shrink with its parent while preventing it from becoming wider than 380 pixels. A 30px padding value creates space around the content, while the #08111f background provides the dark base. The card also has a subtle semi-transparent border and a 20px border radius.

A soft shadow is applied with box-shadow: 0 18px 45px rgba(0,0,0,.28). The card becomes more interactive on hover through three transitioned properties: transform, border-color, and box-shadow. Each uses a .3s ease transition. For more information about this behavior, see the MDN CSS transitions documentation.

When hovered, the card moves upward by 7px using transform: translateY(-7px). Its border changes to a semi-transparent cyan, and the shadow becomes larger. A second cyan-tinted shadow adds a subtle glow around the card without changing its HTML structure.

The .testimonial-rating element contains five star characters. CSS gives them a warm #fbbf24 color, a 15px font size, and 2px letter spacing. Because the stars are written directly in the HTML, there is no rating calculation or dynamic star-generation logic behind them.

Below the rating, .testimonial-quote contains the customer review. Its lighter blue-gray #c7d2e5 color separates it visually from the brighter user name. A 15px font size and 1.8 line height give a longer testimonial enough vertical spacing to remain readable. The quote also has a 26px bottom margin before the author section.

The .testimonial-user area is a flex container. align-items: center vertically aligns the avatar with the user information, while a 14px gap separates the two. A subtle top border and 20px top padding create a clear division between the review and the author details.

Instead of loading a profile photo, the component uses a circular .testimonial-avatar containing the initials SJ. It measures 50px by 50px, uses border-radius: 50%, and has a cyan-to-purple linear-gradient. Flexbox centers the initials inside the circle, while flex-shrink: 0 prevents the avatar from being compressed.

The final .testimonial-info section uses a column flex layout with a 4px gap. The customer name appears at 14px, while the Product Designer role is displayed at a smaller 12px size and muted #8fa4bd color.

Customizing This Testimonial Card

The existing HTML content and CSS values provide several straightforward ways to adapt the card to a different website or interface.

  • Change max-width: 380px to make the testimonial wider or narrower.
  • Replace the #08111f background with a color that matches your page.
  • Adjust the 30px padding and 20px border radius to change the card’s spacing and shape.
  • Replace the five stars, testimonial text, Sarah Johnson name, Product Designer role, and SJ initials with your own content.
  • Change #fbbf24 if you want a different color for the star rating.
  • Edit the cyan #22d3ee and purple #8b5cf6 values to customize the avatar gradient.
  • Increase or decrease translateY(-7px) to control the hover movement.
  • Modify the .3s ease transitions to change how quickly the hover effect responds.

Where to Use This Testimonial Card

The simple layout makes this component suitable for interfaces where a short customer statement and clear attribution need to appear together.

  • Customer testimonial sections on landing pages.
  • SaaS and software product websites.
  • Portfolio websites showing client feedback.
  • Product or service review sections.
  • Agency websites featuring customer comments.
  • Homepage social-proof sections.
  • Case study pages with short client quotes.

Since the card is self-contained and has no JavaScript dependency, it can also be repeated inside a Grid or Flexbox layout to create a larger testimonial section. For a card design with a more visual hover treatment, the 3D Hover Monster Cards component provides a related approach.

Frequently Asked Questions

Does the Testimonial Card require JavaScript?

No. The published component contains only HTML and CSS. Its hover movement, border change, and shadow effect are all created with CSS.

How does the hover effect work?

The .testimonial-card:hover selector applies translateY(-7px), changes the border to a semi-transparent cyan, and replaces the normal shadow with larger dark and cyan-tinted shadows. These changes transition over .3s ease.

Can I use a profile photo instead of initials?

The current component uses a 50px circular element containing the initials SJ. A real image is not included in the published markup, but the avatar area can be adapted if you customize the component for your project.

Is the five-star rating generated dynamically?

No. The five star characters are written directly inside the .testimonial-rating element. There is no JavaScript or dynamic rating system in this component.

This Testimonial Card keeps the implementation lightweight while providing the essential elements of a customer review: a visible rating, readable quote, user identity, and a simple CSS hover response.

Scroll to Top