Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

FAQ-Accordion-Card solution

verilly•50
@verillyh
A solution to the FAQ accordion card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


All feedback are welcome, though some specific questions came to mind when building this project:

  • How to revert media query changes after using window.matchMedia?

Using CSS' media query, it will automatically reapply the old code when reverting back to desktop resolution, but this doesn't apply for JS' media query. I used JS media query because I needed to change the svg for mobile and desktop, which means changing the src attribute through JS.

I've tried resetting the DOM tree to its original state: const initialBody = document.body.innerHTML; // Do some DOM manipulation document.body.innerHTML = initialBody

That doesn't work for some reason, it'll replace the innerHTML with undefined. It feels like I have to manually revert the changes.

It does make me question though, maybe in the real world, SVG's should've been combined instead of coding with several SVGs, that way we can toggle between the src attribute, but then how would you make the effect of the box showing visible overflow, but the rest of the image is hidden?

  • When to use REM and EMs?

Is one better than the other as margin and padding value? Which is better in what scenarios?

  • Was using flexbox the right choice for this project? Or is grid more appropriate?

Thanks for your time to help me with this. I appreciate it!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on verilly's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License