@Catalina-Hasnas
Posted
Hello, if you don't want to use flexbox yet, you can apply these properties to the container element.
#container {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
padding: 0.5rem;
background-color: hsl(0, 0%, 100%);
}
You can find more information about how this works in this article in the "How to Center a Div Horizontally and Vertically" section. Although don't worry if you don't fully understand it yet. Most of the times, you will see flexbox or grid solutions being favored over this. This is also important to know, but I wouldn't say you must 100% get it or you can't move on with CSS anymore :D.
Also, with the code above you can remove all properties aside border-radius
from the image element. And then, you can give a little top and bottom padding to the last component to give it more space like in the designs :).
Good luck in your CSS journey!
Marked as helpful
@uthmvn
Posted
@Catalina-Hasnas
This is game changer ! Even as a newbie, I didn't struggle a lot to get it (and it's way more easier than what I did, in my opinion :D). I'm looking forward to learn about Flexbox very soon, though ! Thanks for the other advice, really appreciate the exhaustive explanation. Thanks for everything !