@correlucas
Posted
๐พHello Philipp, congratulations for your new solution!
Here's some tips to improve your solution:
I saw that you've used margins
and position relative
to give the container its alignment, this works but is really tricky to control all the content. My advice for your is to use flexbox
to create this alignment.
To make this alignment, first of all put min-height: 100vh
to the body
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 and display: flex
e flex-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 with display: block
and max-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 use object-fit: cover
.
img {
display: block;
object-fit: cover;
max-width: 100%;
}
โ๏ธ I hope this helps you and happy coding!