A mobile first accordion component without javascript
The accordion is a nice way to present summarized content in a space saving format. Again, this can not be must read content.
The details/summary is used as a switcher and label, and in this setup it does contain the content. That is placed in a div with the class="inner"
This way the content can be animated smooth and cross browser and not jumpy like with the allow-discrete. By using the details/summary we get the build in accessibility and
the hidden-until-found functionality. If the same name is used for all details in the accordion the items auto close when opening a new one.
The open property can be used to show the content on pageload.
<sectionclass="faq accordion"style="--acc-summary-icon-position: right;"><detailsname="faq"open><summary>1. Lorem ipsum dolor sit amet
<svgxmlns="http://www.w3.org/2000/svg"width="1em"height="1em"viewBox="0 0 24 24"><pathfill="none"stroke="currentColor"stroke-linecap="round"stroke-linejoin="round"stroke-width="2"d="m6 9l6 6l6-6"/></svg></summary><divclass="inner"><u>Content for faq 1.</u><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div></details><detailsname="faq"><summary>2. Lorem ipsum dolor sit amet
<svgxmlns="http://www.w3.org/2000/svg"width="1em"height="1em"viewBox="0 0 24 24"><pathfill="none"stroke="currentColor"stroke-linecap="round"stroke-linejoin="round"stroke-width="2"d="m6 9l6 6l6-6"/></svg></summary><divclass="inner"><u>Content for faq 2.</u><p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div></details><detailsname="faq"><summary>3. Lorem ipsum dolor sit amet
<svgxmlns="http://www.w3.org/2000/svg"width="1em"height="1em"viewBox="0 0 24 24"><pathfill="none"stroke="currentColor"stroke-linecap="round"stroke-linejoin="round"stroke-width="2"d="m6 9l6 6l6-6"/></svg></summary><divclass="inner"><u>Content for faq 3.</u><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div></details></section>