Design comparison
Solution retrospective
Any tips on how to achieve pixel perfect? The second I start adjusting margins, paddings and positioned elements everything starts to shift and relocate. Thank you
Community feedback
- @brasspetalsPosted about 4 years ago
Hi, Artem! Great job on this challenge, and big kudos for finding a no JS solution!
In order to make it more "pixel-perfect", the first thing you could do is to center the whole FAQ card on the page. To do this with regular CSS, I'd first set the
min-height: 100vh
in yourbody
. Then in your container changeposition
toabsolute
and add the following:top: 50%; left: 50%; transform: translate(-50%, -50%);
You could also add the
checked
attribute to the input of your second question, so that it's open on load as in the design.1@ArtemPonomarenkoPosted about 4 years ago@brasspetals Many thanks for the tips! Will implement in my next challenge! Cheers
0@ApplePieGiraffePosted about 4 years ago@ArtemPonomarenko
Hey, Artem Ponomarenko!
Yes, great job!
Just letting you know another way you could center the accordion (in addition to nice way brasspetals explained) would be to set the
display
property of thebody
toflex
and then set itsalign-items
andjustify-content
properties tocenter
.Also, you could match your solution a little more closely to the original design by changing the direction of the gradient to
top left
or something.There are many great ways to do the same things in CSS!
Keep coding (and happy coding, too)!
1@ArtemPonomarenkoPosted about 4 years ago@ApplePieGiraffe Thank you, much appreciated!
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