Design comparison
Solution retrospective
Seems I have faced pretty major problems with dynamic responsiveness (container relative to device viewport, and child elements relative to container/parents). If anyone would be so kind to give me a piece of advice, based on the code i wrote, on how to not hard-code these things with N @media queries, I'd very much appreciate that!
Thank you!
Community feedback
- @codeswithrohPosted over 3 years ago
To place your whole container at the center of the screen just add
display: grid; place-items: center;
in your body tag. It will save you from using position:absolute.
And for the responsiveness try setting a flex-basis with minmax which will help you a lot in responsiveness.
You can check out my solution as well (https://github.com/codeswithroh/stats-preview)
1@bogdiusfPosted over 3 years ago@codeswithroh Hello Rohit!
Thank you for grid and place-items suggestion. Will definitely start using more often. The dynamic responsiveness, without having to set a @media query for each and every device viewport is killing me a bit, haha. But will 100% take a look at your code and learn! ^^
Have a nice day!
0 - @Aicha-NsangouPosted over 3 years ago
Bonsoir, j'ai essayer de regarder ton coder mais sans commentaire c'est pas facile. Pour centrer il y'a plusieurs méthode, perso j'utilise : La position : absolute ; Top: 50%; Left:50%; Transform:translate (-50%,-50%);
Ce bout de code centre tous les éléments ^^ J'espère t'avoir aider de mon mieux:)
1@bogdiusfPosted over 3 years ago@Aicha-Nsangou Bonsoir Aicha,
I completely forgot about "transform: translate(-50%, -50%). You are a life saver!
As for the comments, thank you for pointing it out. I will start adding comments to the blocks of code! (i am still a rookie ^^ )
Thank you for taking time to answer! Have a great day! ^^
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