Design comparison
Solution retrospective
This is updated version of the challenge using grid and flex for layout. Thank you in advance for all the feedback!
Community feedback
- @correlucasPosted about 2 years ago
👾Hello @Peteksi95, Congratulations on completing this challenge!
Your solution its almost done and I’ve some tips to help you to improve it:
1.Fix the alignment. The best way make this alignment is by using
FLEXBOX
. The first step, is to addmin-height: 100vh
to make the body height size becomes 100% of the viewport height, this way you make sure the container will be aligned vertically since thebody
will display ever 100% of the screen height. After that add two flex properties to make the alignmentdisplay: flex
/align-items: center;
/justify-content: center;
. If you're using the attribution you need to addflex-direction: column
to make the attribution stays under the QR Code component. See the code below:REMOVE THIS PADDING
main { /* padding-top: 6vh; */ }
body { min-height: 100vh; font-family: 'Fraunces', serif; font-family: 'Montserrat', sans-serif; background-color: hsl(30, 38%, 92%); display: flex; align-items: center; justify-content: center; flex-direction: column; }
2.Using
<picture>
you’ve more control over the elements and its better than using the product image as<img>
orbackground-image
. Look that for SEO and search engine reasons it isn't a better practice to import this product image with CSS since this will make it harder to the image. You can manage both images inside the<picture>
tag and use the html to code to set when the images should change setting the devicemax-width
depending of the device (phone / computer) Here’s a guide about how to usepicture
:https://www.w3schools.com/tags/tag_picture.asp
✌️ I hope this helps you and happy coding!
Marked as helpful0@Peteksi95Posted about 2 years ago@correlucas Thank you very much! This was very helpful
1 - @hyrongennikePosted about 2 years ago
Hi @Peteksi95,
Congrats on completing the challenge
If you want to center the card on the page. You can replace you main rule with the following.
main { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
Hope this is helpful
Marked as helpful0@Peteksi95Posted about 2 years ago@hyrongennike Thank you very much, i will keep this in mind!
0@Peteksi95Posted about 2 years ago@hyrongennike Thank you very much, i will keep this in mind!
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