Quotidien Shaarli

Tous les liens d'un jour sur une page.

October 24, 2024

Exclusive accordions using the HTML details element | MDN Blog

Using <details name> to create exclusive accordions
A common use case for accordions is that only one of them should be open at any one time. The addition of the name attribute lets you connect multiple <details> elements and make an accordion exclusive, so only one <details> element with the same name can be open at any time, and the browser toggles all others with the same name to a "closed" state.