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

SASS, PseudoElement, SVG

Benjamin 130

@Benjoow

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


Hello everybody !

Well...contrary to expectation, i had a lot of problems with this challenge.

  • I worked with background-image and not img tag for training. I'm not familiar with this property and it was ...complicated to sizing correctly my illustration card with background-position and size. I've spend lot of time on it and finally rewrite my HTML structure.

  • I've had a problem with my card height and my illustration in position absolute on desktop version. I had to fix the height of my card and used js for close my accordion item when another one is selected otherwise my image would move on same time.

Community feedback

Vanza Setia 27,795

@vanzasetia

Posted

Hi, Benjamin! 👋

Congratulations on finishing this challenge! 🎉

Regarding the problems that you had.

  • For the illustration image, it's hard. When I was doing the challenge, it took a lot of time to make position those images correctly. I used the combination of a background image and img elements.
  • I would not recommend specifying any height to the card element. When I inspected the card element and remove the height of the card, the card still looks good. I don't think there's a way to prevent the jumping layout because each content has a different height. So, I think it's okay to let the element move a little bit each time the user opens another accordion panel. (it's just my opinion).

Now, for the feedback.

  • What's the purpose of the setTimeout? If it's only for development purposes, I highly suggest removing it.
  • I recommend adding more margin-top on the body element. Currently, on my mobile view, the illustration image touches the top edge.
  • I suggest separating the function from the event listener. This way, you can give a descriptive name to the function. By doing this, it allows other developers to understand what the function is doing without actually seeing the lines of code inside it.

I hope this helps! Keep up the good work! 👍

Marked as helpful

2

Benjamin 130

@Benjoow

Posted

@vanzasetia Thank you a lot for your precious feedback !

I'm modified my solution by removing setTimeout (i forgot to delete it) and creating a new media query to make things right on your mobile device. (i hope it's work). Even for such simple exercice, you can have so many media query...

How do you manage that ? Any advice or article to read ?

Oh and i kept the height of my card, i don't like to see the illustration jumping when i deploy my accordion :-).

Once again, thank you Vanza !

0
Vanza Setia 27,795

@vanzasetia

Posted

@Benjoow I think this only needs one media query for the desktop layout. So, to simplify the styling,

  • First, style the mobile layout
  • Second, style the desktop layout with a media query
  • That's it! 🙂

I believe it's about practice because I think practice makes me better. So, don't worry too much about it, you can always come back and refactor the CSS once you've gained more experience.

You're welcome, Benjamin! 👍

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