Using the details element, we can build an HTML accordion in just four lines of code. By default, the <details> element loads in a closed state. We can load the accordion open by default by adding the open attribute to the < details> element.

2m read timeFrom dev.to
Post cover image
Table of contents
Use the HTML details elementBrowser support and accessibilityFurther reading
2 Comments

Sort: