The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › help with id for CSS and HTML for pure CSS Accordion
The attached code works above, without issue.
However, the page that I often want to use requires multiple accordion items, which as it stands requires me to edit the HTML code and change the id value incrementally for every accordion.
I was wondering if there is a change in the code I can do so all accordions do not require an ID and the styles are propagated for all versions/copies of the accordion code in the HTML.
Hopefully, that makes sense.
While I’m not seeing the JS required for this, you’d just need to change from IDs to classes, just something unique you can name them.
Personally I like the Bootstrap approach. https://getbootstrap.com/docs/4.3/components/collapse/#accordion-example