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

faq accordion

Newton Das 190

@dasnewton305

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


On toggling the FAQ questions the image box and the shadow is not shifting with the illustration image . Can anyone explain why the image and shadow is behaving that way and how can i fix that . Thanks

Community feedback

M 940

@Dev-MV6

Posted

The reason this happens is that the illustration shadow is the background image of the container with the class header-images, when the height of the container increases, the background image remains fixed at the top because the value you set for background-position-y in the desktop design is -40px, you are using absolute units (pixels). One option you have to fix it without restructuring your whole design is by using relative units like percentages instead:

.header-images {
  background-position-y: 20%; /* Same value you are using for the `top` property of the illustration */
}

This way, every time the container size changes CSS will recalculate where the background should be positioned relative to the new size.

Another option you have is to restructure your design and try to position the illustration and the shadow in a way they don't get affected when the container height changes.

Good luck!

PS: I like the dropdown transition, expanding feels smoother that way 👍.

Marked as helpful

0

Newton Das 190

@dasnewton305

Posted

thank you @Dev-MV6

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