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

Submitted

Responsive Accordion without JS.

@ArtemPonomarenko

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


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

Anna Leigh 5,135

@brasspetals

Posted

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 your body. Then in your container change position to absolute 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

@ArtemPonomarenko

Posted

@brasspetals Many thanks for the tips! Will implement in my next challenge! Cheers

0
P
ApplePieGiraffe 30,545

@ApplePieGiraffe

Posted

@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 the body to flex and then set its align-items and justify-content properties to center.

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

@ArtemPonomarenko

Posted

@ApplePieGiraffe Thank you, much appreciated!

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