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

CSS Solution using CSS Flexbox and a mix of and background

Pierre•215
@pchatard
A solution to the FAQ accordion card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I mainly used CSS Flexbox to properly position everything concerning the text.

I had some trouble on positioning the different svgs. I used a mix of img HTML tags and background css properties to do it. What would be the proper way of doing this? As we had different images for desktop and mobile sizes I used the background properties... but I had trouble positioning everything and mostly fixing everything (as you can see, it's moving a bit when opening a question or resizing the browser).

To open a question, I used JS to toggle an active class on the clicked question. Is there a full CSS way of doing so ?

Last point, how many media queries should be used here ? I used two, one for tablets and one for mobiles. I added one main breakpoint which is on tablets portrait mode here. A second one to adapt font size. What would be the best practices on this ?

Thank you! This is my first challenge here :)

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 Pierre'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

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