Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Create an Accordion Menu with CSS

Close accordion menu on click

Everything in my program works and matches what is done in the video, but I would also like the menu option to close on click. Right now the accordion option opens on click and closes when you click another option. But this means that after the initial click an option is always open. I would like the accordion option to close when you click on the title again.

3 Answers

You could use checkbox as the input type attribute rather than radio however this means that if you open another tab the currently open ones will stay open.

Tiffany McAllister
Tiffany McAllister
25,806 Points

I may be wrong but I think you'd probably require JavaScript for this.

reload :D and everyone's happy again