32 CSS Accordions — Vertical & Horizontal

32 Pure CSSPublished 6 new designs · Updated on

32 CSS accordions for FAQ sections, mobile nav menus, product filter sidebars, and docs file trees — spanning native <details>/<summary> disclosure, animated open heights, exclusive single-open groups, nested tree views, plus-minus and chevron icons, brutalist, glass and aurora styles, and horizontal strip, image-reveal, color-block and cinema-reel layouts. Scoped under .acc-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.

Related25 CSS FAQ Accordions32 CSS Tabs22 CSS Dropdown Menu Designs15 CSS Navigation Menus32 Tailwind CSS Accordions — Vertical & Horizontal

Course pickPartner: Zero to Mastery

Affiliate link

Want to build production-ready CSS layouts, animations and UI from scratch?

You just browsed 32 accordions. Learn the Flexbox, Grid and animation thinking behind them, so the next component starts in your head, not in a copy-paste.

10% off at checkout with code
Check ZTM Course

Every ZTM course in one membership: $25/month, paid yearly at $299 · 30‑day money-back guarantee

The CSS Bootcamp. We may earn a commission, at no extra cost to you.

Vertical Accordions24

Newsletter

Enjoying these demos? Get new ones by email.

A short email when a new collection ships. Unsubscribe any time.

at

Almost there: check your inbox to confirm.Manage

Newsletter

Enjoying these demos? Get new ones by email.

A short email when a new collection ships. Unsubscribe any time.

at

Almost there: check your inbox to confirm.Manage

15. Diagonal Slant Accordion — Skewed Parallelogram Headers (opens in a new tab)

PublishedUpdated

Pure CSS
Headers as racing stripes: every summary is a parallelogram skewed −6°, stacked with alternating offsets so the closed accordion reads as a dynamic diagonal composition. Opening un-skews the active stripe back to square while its body slides out beneath — geometry itself is the state indicator. Built for sports, esports and event brands.

16. Stepped Stair Accordion — Indented Cascade with Depth Levels (opens in a new tab)

PublishedUpdated

Pure CSS
Items descend like a staircase: each header starts progressively indented and narrower, connected by corner brackets, so the closed state is already a diagram of descent. Opening a step slides it flush-left to full width — it 'steps forward' out of the stair to speak. A layout-as-metaphor pattern for processes that go deeper, funnels and layered architectures.

22. Stacked Cards Deck Accordion — Overlapping Pull-Out Hand (opens in a new tab)

PublishedUpdated

Pure CSS
Items rest as a fanned deck — each card overlapping the one above by half, peeking just its header edge like held playing cards. Selecting a card pulls it out of the stack: it slides down clear of the fan, flattens straight and opens, while the deck closes ranks above it. Spatial, tactile, and unlike any list-shaped accordion.
Newsletter

Enjoying these demos? Get new ones by email.

A short email when a new collection ships. Unsubscribe any time.

at

Almost there: check your inbox to confirm.Manage

23. Holographic Slot Accordion — @property Rotating Border Sheen (opens in a new tab)

PublishedUpdated

Pure CSS
Each closed item is a dark slot ringed by a faint conic seam; the open one ignites — a holographic gradient beam orbits its border continuously while an iridescent sheen sweeps the header text. The 'animated gradient border' effect done properly with a registered @property angle and mask-composited ring, for AI products, gaming and dev-tool launches.

Horizontal Accordions8

FAQ

Frequently asked questions

How do I build a pure CSS FAQ accordion with no JavaScript?
Use the native <details> and <summary> elements — one <details> per question, the question text inside <summary>, and the answer as the details content. The browser handles opening, closing, keyboard toggling with Enter and Space, and disclosure semantics for screen readers, all for free. Style the summary's ::marker away and draw your own chevron or plus/minus indicator with CSS. Demo 01 in this gallery is the canonical pattern — every answer is real DOM text so Google indexes it, Chromium's find-in-page auto-opens the matching item on match, and no JavaScript bundle is loaded. Add FAQPage JSON-LD schema in your page head to unlock the accordion rich-results carousel in Google search.
Can I animate a CSS accordion smoothly to height: auto?
Yes — modern CSS finally solved this in 2024. Set interpolate-size: allow-keywords on your accordion root (or on :root site-wide) and add a transition to the ::details-content pseudo-element: height: 0 in the closed state, height: auto when [open], plus overflow: clip and transition-behavior: allow-discrete on content-visibility so the close animation runs before the content hides. Demo 05 shows the full recipe. Browsers without support (currently Firefox and Safari <18.4) simply toggle instantly, which is the correct progressive-enhancement fallback — the accordion still works everywhere, it just animates in Chrome 131+ and Safari 18.4+.
How do I make one accordion item close automatically when another opens?
Add the same name attribute to every <details> element in the group — for example <details name="faq"> on all of them. The browser will enforce exclusive opening natively, exactly like a radio-button group: opening one closes the currently-open sibling, with no JavaScript. This is the details name attribute, baseline in Chrome 120+, Safari 17.2+ and Firefox 130+ (March 2024 baseline). Older browsers ignore the attribute and simply allow multiple items open at once — a graceful, non-breaking degradation. Demos 03 (e-commerce filter sidebar), 06 (exclusive single-open) and 27 (code-comment accordion) all use this pattern.
What's the difference between a vertical and horizontal CSS accordion?
A vertical accordion stacks panels top-to-bottom and expands them downward — the familiar FAQ pattern using <details>/<summary>. A horizontal accordion places panels side-by-side and expands them sideways, typically with radio inputs plus <label> targets and CSS flex-grow transitions on :checked. Vertical is right for FAQs, release notes, docs and mobile menus (scannable, mobile-friendly). Horizontal is right for image galleries, portfolio showcases, feature strips and desktop hero sections where lateral space is plentiful. This collection ships 8 vertical (demos 07-14), 8 horizontal (demos 15-22), 6 use-case-first (demos 01-06), and 10 hybrid or pattern-breaking variations (demos 23-32) so you can pick whichever fits.
Are these CSS accordions accessible for keyboard and screen-reader users?
Yes. All 24 vertical demos use native <details>/<summary>, which the browser exposes as a disclosure button with a keyboard-operable toggle (Enter and Space), announces state changes ("collapsed" / "expanded") to screen readers, and integrates with browser find-in-page. Every summary carries a visible :focus-visible ring meeting 3:1 contrast. Horizontal demos use real <input type="radio"> plus <label> — arrow-key navigable inside the group and announced as a radiogroup by assistive tech. Every demo with continuous motion (marquee, aurora drift, equalizer bars) ships a prefers-reduced-motion calm-down block. Touch demos (mobile menu, filter sidebar) meet the WCAG 2.5.8 48×48px minimum touch target.
How do I build a mobile navigation menu with pure CSS accordion drill-downs?
Combine a visually-hidden <input type="checkbox"> hamburger with :has(:checked) driving a grid-template-rows 0fr → 1fr animated panel, then nest <details> categories inside for drill-down. Each category summary is a 52px row (comfortably above the WCAG 48px touch minimum), the plus indicator rotates 45° into an X on open, and child links indent with a border-left rule for visible hierarchy. Zero JavaScript, works in reader modes, respects browser back button. Demo 02 is the complete pattern. Requires :has() support (Chrome 105+, Safari 15.4+, Firefox 121+, baseline since 2023); without :has() the panel stays open — content is never lost, only the toggle stops working.
How do I build an e-commerce filter sidebar accordion in CSS?
Use <details name="filters"> so opening one filter group (Size, Color, Price) closes the others, then style real <input type="checkbox"> controls with their :checked sibling spans for size chips, color swatches with a ring indicator, and a checkbox list for price ranges. Every element stays a native form control, so the form submits, keyboards work, and screen readers announce state — no divs pretending to be checkboxes. Result-count badges use margin-left:auto to push right. Demo 03 ships the full pattern. Exclusive open via the name attribute is baseline since 2024; older browsers gracefully allow multiple groups open.
Are these accordions safe to copy-paste into an existing project?
Yes — every demo is scoped under a unique .acc-NN wrapper (acc-01, acc-02, …, acc-32), so any two demos coexist on one page with zero style bleed. All @keyframes are prefixed acc-NN- to avoid name collisions, and every input id or details name attribute is namespaced acc-NN-*. Continuous motion is guarded with @media (prefers-reduced-motion: reduce). No external dependencies, no framework, no runtime JavaScript — the code you copy is the code that renders in your browser. MIT licensed for personal and commercial projects, no attribution required.

Related collections

39 CSS Breadcrumbs preview

39 CSS Breadcrumbs

39 hand-coded CSS breadcrumbs — Schema.org BreadcrumbList Microdata + WCAG 2.2 accessible (Google Rich Results eligible), :has() responsive collapse, dark/light theme toggle with color-mix, Shopify/Amazon e-commerce filter chip removal, Vercel/Linear/Notion SaaS dashboard app-shell pattern, Docusaurus/Mintlify sticky scroll-shrink header, Amazon-style dropdown sibling menus, NFT/Web3 holographic shimmer (@property + conic-gradient), SaaS marketing gradient text, Airbnb filter chip with container queries, editorial blog wave underline, developer docs one-click path copy (Clipboard API), and 26 more. Semantic HTML: <nav aria-label='Breadcrumb'> + <ol> + aria-current='page'. Framework-agnostic, MIT-licensed.

26 CSS Circular Menus preview

26 CSS Circular Menus

26 hand-coded CSS circular and radial menu designs, from the floating-action FAB speed dial and dashboard radial hubs to game-style pie-slice wheels, SVG gooey metaball fans, hexagonal honeycombs, iris-aperture reveals, orbiting satellites on offset-path, compass-rose directional nav, sci-fi HUD rings, glassmorphism popovers built on the native Popover API, vinyl-record players, and full-takeover nebula overlays on native dialog. Every design uses CSS trigonometry (sin(), cos()) or the counter-rotation trick for positioning, ships real keyboard navigation, aria-labels on icon-only buttons, and a prefers-reduced-motion guard. Copy-paste HTML, CSS and vanilla JS with zero framework dependencies — MIT licensed.

22 CSS Dropdown Menu Designs preview

22 CSS Dropdown Menu Designs

22 hand-coded CSS dropdown menu designs with live demos — slide-down fade, clip-path curtain reveal, 3D perspective flip, elastic bounce spring, glassmorphism float panel, stagger children reveal, mega-menu grid, underline nav fade, native details/summary, checkbox-hack mobile nav, nested multi-level flyout, icon sidebar flyout, split-screen mega-menu, segmented pill nav, color swatch picker, right-click context menu, keyboard-accessible roving tabindex, stagger blur entrance, command palette search, autocomplete suggestion, click-outside close, and multi-select chip. 15 pure CSS + 7 with a tiny vanilla JS snippet — no framework. WCAG 2.2 aria-expanded + aria-haspopup + focus management, prefers-reduced-motion honoured, MIT licensed.

Search CodeFronts

Loading…