This code is a basic implementation of an accordion-style Q&A section using HTML, CSS, and JavaScript.
The HTML section contains a section with a class of "questions" that contains multiple articles, each representing a question and answer.
The JavaScript section selects all elements with a class of "question" and attaches a click event listener to their "btn" child element. When clicked, the "question-text" div toggles its visibility by adding or removing a "show-text" class from the "question" div. The "show-text" class is defined in the CSS to have a height of auto and overflow: visible, making the answer visible when added. The JavaScript code controls the display of the answers when the user clicks the plus/minus button, toggling the visibility of the answer text.
You can try out the application by visiting this link.
- HTML
- CSS
- JavaScript
To get started with this project, clone the repository and open the index.html
file in your preferred web browser.