Design comparison
Solution retrospective
Is there an easy way to center the element?
Community feedback
- @PhoenixDev22Posted about 2 years ago
Hi Sef Palima,
Congratulation on completing this challenge. Your solution looks great. I have some suggestions regarding your solution if you don’t mind:
- You can use
<main>
for the card and <footer> for the attribution. HTML5 landmark elements are used to improve navigation.
<main> </main> <footer> </footer>
- In my opinion, the alternate text should indicate where the Qr code navigate the user : like
QR code to frontend mentor.
- Add
min-height: 100vh
instead ofheight: 100%
to the body that let the body grows taller if the content outgrows the visible page instead.
width: 330px
an explicit width is not a good way to have a responsive layout. Consider usingmax-width
to the card inrem
instead.
height: 500px
It's not recommended to set height to component, let the content of the component define the height.
Hopefully this feedback helps.
Marked as helpful0@sef1210Posted about 2 years ago@PhoenixDev22 I'm having a hard time when I'm not setting the height but I will try next time :)
Thank you so much for your feedback highly appreciated :)
1 - You can use
- @0ME9APosted about 2 years ago
Hi @sef1210 !!!
Your design looks almost the same, and as a developer, I'm happy you did this. So now let's come to the point
There are several ways to center an element(s).
- display: flex, justify-content: center, align-items: center --(inside parent div/element)
- position: absolute, left: 50%, top: 50%, transform-translate: (-50%, -50%) --(apply in that div which you want to center and important apply position: relative ---------in parent div)
- margin: auto --(Horizontal align)
There are still more ways to center elements but I mostly use these css. #HappyCoding🧑💻
Marked as helpful0@sef1210Posted about 2 years ago@0ME9A thus the margin: auto will not work on vertical align?
thank you so much for your feedback highly appreciated :)
0 - @DavidMorgadePosted about 2 years ago
Hello Sef, congrats on finishing the solution to this challenge!
I think that using flex-box in this case is one of the best options you can use, other option could be using
display-grid
andalign-content: center
andjustify-content: center
on yourbody
, but it would get the same result!Great job, there are few people that gets to center this component on the first try!
Hope my answer helped you!
Marked as helpful0@sef1210Posted about 2 years ago@DavidMorgade thank you so much for your feedback highly appreciated :)
0
Please log in to post a comment
Log in with GitHubJoin 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