CSS Accordion Generator
Generate a pure-CSS accordion using the details and summary elements, with custom colours and radius. No JavaScript.
Last reviewed by the Radiatus Cloud team
Generate a pure-CSS accordion with the details element – no JavaScript.
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Build an accordion with pure CSS
Accordions let users expand and collapse sections of content, saving space and keeping pages tidy. This generator produces an accordion using the native details and summary HTML elements, which provide open-and-close behaviour with no JavaScript at all. You choose the header background, text colour and corner radius, and the tool outputs the CSS plus the simple HTML structure, including a plus-and-minus indicator that flips when a section opens.
Because it uses built-in elements, the accordion is accessible and keyboard-operable out of the box.
Accessible and lightweight
The details element is the modern, standards-based way to build disclosure widgets. It handles the toggling natively, is announced correctly by screen readers, and works even if scripts fail, which is why it is preferred over JavaScript accordions for simple cases. It is perfect for FAQs, nested navigation and progressive content.
Style the summary as the clickable header and the body as the revealed content. The open attribute lets you target the expanded state in CSS. All generation happens locally in your browser.
Notes on the generated code
Because the css accordion generator runs entirely in your browser, you can experiment with every option and watch the generated code update instantly, with nothing uploaded and no account required. The output is clean, standards-based CSS that works in any project without external libraries or a build step, so you can paste it straight into your stylesheet and refine it further by hand whenever you need to.
Related tools
- Color Converter — Convert colours between HEX, RGB, HSL, HWB and OKLCH, with alpha support. Runs in your browser and shows the live swatch for each format.
- Accessibility Color Contrast Checker — Check foreground and background colour contrast against WCAG thresholds, with the rules for text size, UI components and states.
- Typography Scale Generator — Generate a modular type scale from a base size and ratio, with fluid clamp() values for responsive layouts.
- Design Token Generator — Generate design tokens as CSS variables, JSON or platform formats, structured in the layers that make them maintainable.
Frequently Asked Questions
Does this accordion need JavaScript?
No. It uses the native details and summary elements, which provide expand and collapse behaviour with no scripting.
Is it accessible?
Yes. The details element is keyboard-operable and announced correctly by screen readers, so it is accessible by default.
How do I show which section is open?
The generated CSS targets the open attribute to flip a plus sign to a minus, indicating the expanded state.
Can multiple sections be open at once?
Yes, by default each details element is independent. To allow only one open, give them the same name attribute in supporting browsers.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Choose the colours and radius, then copy the HTML and CSS.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
Color Converter
DesignConvert colours between HEX, RGB, HSL, HWB and OKLCH, with alpha support. Runs in your browser and shows the live swatch for each format.
Accessibility Color Contrast Checker
DesignCheck foreground and background colour contrast against WCAG thresholds, with the rules for text size, UI components and states.
Typography Scale Generator
DesignGenerate a modular type scale from a base size and ratio, with fluid clamp() values for responsive layouts.