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 social proof section using Flexbox

@gchristofferson

Desktop design screenshot for the Social proof section coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm wondering if there is a more elegant solution to the offset positioning of the review and testimonial boxes? I offset them by first setting the position to relative for all boxes and then by selecting the appropriate :nth-child(). I then adjusted the bottom or left positioning. I'm sure there is a more elegant solution and if you know of one I would love to hear your feedback.

Community feedback

P
Kenβ€’ 4,915

@kens-visuals

Posted

Hey @gchristofferson πŸ‘‹πŸ»

I'm not sure if my solution is the elegant one that you're looking for, but what I did is similar. However, instead of using position: relative I just selected them with :nth-child() and with transform: translate() positioned them as necessary. Here, if you need some review check the link.

Cheers πŸ‘Ύ

Marked as helpful

1

@gchristofferson

Posted

Hey @kens-visuals!

That's perfect! I'm always looking for ways to make my code more succinct like this. Do you know if there is any hit in performance when using transform: translate() as opposed to using relative positioning? It's probably not significant if there is a difference, but I'm curiousπŸ€”

0
P
Kenβ€’ 4,915

@kens-visuals

Posted

Hi @gchristofferson πŸ™‹πŸ»β€β™‚οΈ

I'm sure about the performance, but I know for sure that, positioning things are a lot trickier than, using translate. Especially position absolute, I'm not discouraging the use of position, but one should be careful with it πŸ™ƒ

Marked as helpful

0

@gchristofferson

Posted

Hey @kens-visuals!

That makes sense, I'm going to default to using translate for moving elements going forward. Thanks again for your feedback!

0
Shawnβ€’ 90

@Shawwnscott

Posted

I added helper classes for mine.

for the reviews then added margins and used percentages so the sizing remained somewhat consistent with resizing.

for the testimonials I used the transform: translateY property and also used a different percentage for each.

https://brave-shockley-288b01.netlify.app/

Marked as helpful

0

@gchristofferson

Posted

Nice job @FrassDaddy! πŸ‘

0
Erel Ropetaβ€’ 385

@erelropeta

Posted

What I did was used flexbox, then used justify-continent for the reviews and align-self for the testimonials :)

Marked as helpful

0

@gchristofferson

Posted

Hey @erelita!

That's awesome! I tried to position the boxes with flexbox too but couldn't get it to work like I wanted. That's awesome you were able to get it to work! πŸ‘

0
Erel Ropetaβ€’ 385

@erelropeta

Posted

@gchristofferson

I looked into your HTML again. If you would want to try it again, you can add a wrapper class outside each of the social-rating and testimonial classes. Then you can apply the display:flex on the wrappers :)

Marked as helpful

1

@gchristofferson

Posted

Hi @erelita! πŸ™‹β€β™‚οΈ

I tried your suggestion and I was able to align and offset the boxes using flexbox instead! To get it to work though, I also had to set a height for the wrappers. Then I was able to use align-self: flex-end and flex-start for the appropriate :nth-child.

Here's the preview link: https://social-proof-section-928xy06ss-gchristofferson.vercel.app/

Here's the code: https://github.com/gchristofferson/social-proof-section/tree/flexbox-alignment-test

Thanks again for your awesome tips!

0
Erel Ropetaβ€’ 385

@erelropeta

Posted

@gchristofferson I'm happy you tried it and it looks great! :)

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