Submitted over 1 year ago
Responsive Results Summary Component - with HTML and CSS
@the-soban
Design comparison
SolutionDesign
Solution retrospective
Hi Fellow Learners!ππ» Hope you are doing well!
- I participated in the Results Summary component challenge to improve my skills in building consistent layouts in CSS.π
- This challenge was pretty simple overall for me, except for one thing: making the layout in desktop version. π»
- The reason I say that is because the left-hand box had to be placed above the right box. It took me some time to understand the logic behind it but it was all easy once I looked up some code documentation on W3Schools and StackOverflow. π
- Feel free to provide any feedback, suggestions. They are always a great help. Peace! π
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have other recommendations regarding your code that I believe will be of great interest to you.
CSS π¨:
- Looks like the component has not been centered properly. So let me explain, How you can easily center the component without using
margin
orpadding
.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- To properly center the component in the page, you should use
Flexbox
orGrid
layout. You can read more about centering in CSS here π.
- For this demonstration we use css
Grid
to center the component.
@media only screen and (min-width: 1366px) { body { min-height: 100vh; display: grid; place-items: center; } }
- Now remove these styles, after removing you can able to see the changes
@media only screen and (min-width: 1366px) .main-box { margin-top: 22vh; }
- Now your component has been properly centered
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1@the-sobanPosted over 1 year agoThank you for taking out your time and suggestion a better approach @0xAbdulKhalid ππ»
I have tried what you suggested and it works totally fine, like a charm! β
I would definitely use this technique in all my future code, Thanks Again! π
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