Forums

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

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #292405

    https://codepen.io/acedanger/pen/gNKRqg

    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.

    #292420
    uxfed
    Participant

    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

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.