CSS Show More Button

A "Show more" toggle built on details and summary that flips to "Show less" and rotates its chevron.

  • details
  • summary
  • expand
  • collapse
  • read more
  • chevron
HTML
<details class="show-more">
  <summary>
    <span class="show-more-closed">Show more</span>
    <span class="show-more-open">Show less</span>
    <svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
  </summary>
  <p>Every plan includes unlimited projects, priority support and a 30-day money-back guarantee.</p>
</details>
CSS
.show-more {
  max-width: 320px;
  font: 15px/1.5 system-ui, sans-serif;
  color: #3f3f46;
}

.show-more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid #e4e4e7;
  border-radius: 999px;
  color: #18181b;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.show-more summary::-webkit-details-marker {
  display: none;
}

.show-more summary:hover {
  background: #f4f4f5;
}

.show-more summary:focus-visible {
  outline: 2px solid #18181b;
  outline-offset: 2px;
}

.show-more svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.show-more-open,
.show-more[open] .show-more-closed {
  display: none;
}

.show-more[open] .show-more-open {
  display: inline;
}

.show-more[open] svg {
  transform: rotate(180deg);
}

.show-more p {
  margin: 12px 0 0;
}

About this CSS Show More Button

This CSS Show More Button is 60 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses transitions, transforms, Flexbox 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:

  • #3f3f46
  • #e4e4e7
  • #18181b
  • #f4f4f5

How to use this show more button

  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 .show-more 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