Design comparison
Community feedback
- @correlucasPosted about 2 years ago
๐พHello Philipp, congratulations for your new solution!
Here's some tips to improve your solution:
I saw that you've used
margins
andposition relative
to give the container its alignment, this works but is really tricky to control all the content. My advice for your is to useflexbox
to create this alignment.To make this alignment, first of all put
min-height: 100vh
to thebody
to make the body display 100% of the viewport height (this makes the container align to the height size thats now 100% of the screen height) size anddisplay: flex
eflex-direction: column
to align the child element (the container) vertically using the body as reference.To make the image have a better fit inside of it, make the component image responsive withdisplay: block
andmax-width: 100%
(this makes the image fit the column/div size) and respect the component size while it scales down. To make it crop while scaling useobject-fit: cover
.img { display: block; object-fit: cover; max-width: 100%; }
โ๏ธ I hope this helps you and happy coding!
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