Design comparison
Solution retrospective
I had difficulty trying to figure out how to prevent my card from raising to the top when I would open up the accordion. In the end, I just started the card low enough but I didn't figure out how to maintain the top position of the card.
Community feedback
- @mihalymarcell86Posted over 2 years ago
Hi @samanthascarcella,
first of all, congrats on your solution. Very nice! :)
The reason for your card seemingly moving to the top is that you set
align-items: center
on thebody
. Every time you open a dropdown, the overall height of your card component changes, and flexbox repositions it accordingly. It stretches in both directions. The way I solved this issue was that I setalign-items: flex-start
and addedpadding-top
instead to position the card. This way, when it resizes, it will only extend downwards.Hope, that helps!
Marked as helpful0@samanthascarcellaPosted over 2 years ago@mihalymarcell86 Thank you so much! I added a margin to my card after your comment and it resolved the problem. Thank you so much for the tip!
0@mihalymarcell86Posted over 2 years ago@samanthascarcella Happy, I could help! :)
0
Please log in to post a comment
Log in with GitHubJoin 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