Design comparison
Solution retrospective
Just a simple one :) any advice is welcome, long time since I didn't make something using css and html
Community feedback
- @correlucasPosted about 2 years ago
👾Hello @Rebeitte, Congratulations on completing this challenge!
Your solution its almost done and I’ve some tips to help you to improve it:
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
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:body { min-height: 100vh; background-color: var(--Cream); display: flex; align-items: center; justify-content: center; }
✌️ I hope this helps you and happy coding!
Marked as helpful1@RebeittePosted about 2 years ago@correlucas Thank you, I will try to use the picture tag and fix the alignment.
1 - @faha1999Posted about 2 years ago
Hello, Jesus Rebeitte Congratulations on finishing this project. It's lovely and great on the whole! Just a little tip:
- add the below styles to the
body
. It will center everything
body { justify-content: center; align-items: center; display: flex; min-height: 100vh; flex-direction: column; }
I hope it will work. Happy coding.
1@RebeittePosted about 2 years ago@faha1999 Thank you! I did this already and it looks better
0 - add the below styles to the
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