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

QR Code Component design using flexbox and using viewport height

Jork 230

@jc-padua

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please tell me everything that is all wrong in my way of coding.

What is the best way to center div?

Do you have any tips in about best practices?

Community feedback

Vanza Setia 27,795

@vanzasetia

Posted

Hello Urinzi! 👋

Congratulations on completing this challenge! 🎉

In this case, the best way to center the card element is to make the body element as either grid or flexbox container. So, I would recommend removing the flex properties from the card element. After that, add place-items: center and use min-height instead of height property.

place-items: center is equal to justify-content: center and align-items: center. I recommend using min-height because it will make sure that the body element would allow to grow if ever needed.

Some best practices.

  • figure element doesn't need to wrap the img element. The only reason to use figure is if you need to include a figcaption. Otherwise img tag is fine.
  • Use single class selectors for styling whenever possible instead of id. id has high specificity which can lead to a lot of issues on the larger project. It's best to keep the CSS specificity as low and flat as possible. 😉

I hope this helps!

Marked as helpful

0

Jork 230

@jc-padua

Posted

@vanzasetia Thank you so much! It would be very helpful in improving my responsive designs and the proper use of elements in HTML. I'm grateful to have advice from an expert like you. Thank you so much! It motivates me a lot!

0
Vanza Setia 27,795

@vanzasetia

Posted

@jc-padua No problem! 😄

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