Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

FAQ accordion using Sass

P

@IncorrigibleSpirit

Desktop design screenshot for the FAQ accordion coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

Overall, I learned to use the and tags in HTML for creating collapsible sections. Additionally, I explored how to incorporate JavaScript to toggle classes and enable keyboard navigation through properties.

document.querySelectorAll(".faq_heading").forEach((heading) => {
  heading.addEventListener("click", () => {
    const faqItem = heading.parentElement;
    faqItem.classList.toggle("active");
  });
});
:focus-visible {
  outline: 0.1875rem dotted #9b59b6;
  outline-offset: 0.125rem;
}

What challenges did you encounter, and how did you overcome them?

Following the model was a bit tricky. The unique way to achieve the same result was by using the and tags in HTML to create collapsible sections.

Community feedback

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord