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
Desktop design screenshot for the FAQ accordion card coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


The most difficult part of this project was positioning the image for the desktop, and figuring out the position and height of the container when the accordion is opened up. It took me a lot of tries, searches and almost giving up, but I finally figured it out-ish.

Community feedback

@yefreescoding

Posted

You did an amazing job!! I can give you some tips, and solutions for "figuring out the position and height of the container when the accordion is opened up".

  • First your body, I think has too much height:
body {
    height: 170vh;
   /* rest of the styles */
}
/* Use the css calc function */
body {
    /* 
    After do some testing 200px won't make the accordion 
    to cause overflow when it is fully open.
    */
    height: calc(100vh + 200px);
    /* rest of the styles */
}
  • In addition to that, use the align-items property and give it the value start, this will position your component to the top of the page.
body {
    height: 170vh;
    display: flex;
    align-items: start;
    justify-content: center;
}

  • Theres no need to give your container all that margin, a margin auto will make a better fit:
.container {
   /* All the styles */
    margin: auto;
}

Just one more thing. Try to use less px as measure unit, and lear about relative units like em, and rem.

Overall I think you did a great job. Your code is easy to read, semantic, and accesible. You develop the solution mobile first, for I could see in your code, that's a really good practice. Your solution and the original design are identical. Congrats!!

Marked as helpful

0

@Mkzay

Posted

This was really helpful, thank you! @yefreescoding

0

@yefreescoding

Posted

@Mkzay

You're welcome! Just wanted to say that I found an even better solution: Adding a overflow: scroll to the parent container 😅, in this case to the body.

Marked as helpful

0

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