Design comparison
SolutionDesign
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 correctly. 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
body { min-height: 100vh; display: grid; place-items: center; }
- Now remove these styles, after removing you can able to see the changes
body { padding: 50px 0; }
- Now your component has been properly centered
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
0 - @ecemgoPosted over 1 year ago
Some recommendations regarding your code that could be of interest to you.
HTML
- You should replace
<div>
with the<main>
tag in html file.
<main> <img> <h2></h2> <p></p> </main>
CSS
- You'd better use flexbox for this solution to center the card correctly and easily.
- Firstly, you don't need to use the
padding
for thebody
- Instead of
padding
, you can add flexbox andmin-height: 100vh
to thebody
to center it
body { /* padding:50px 0; */ display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; }
- Finally, you need to change the name of
div
in thestyle
tags tomain
main{ /* this was your div please change its name like this */ background-color: #fff; margin: auto; border-radius:25px; width:20rem; padding:15px 15px 25px 15px; }
Hope I am helpful. :)
0 - You should replace
- @atif-devPosted over 1 year ago
Hi pra-23845, congratsπ on completing the challenge. Better take care about following points.
- Instead of using
padding: 50px 0;
use following block of code for proper centering.
body { min-height: 100vh; display: grid; place-content: center; }
- When we open GitHub repository link, at right side you will find an About Section. There, also include live preview link of your project. It is better for someone to check your live project while interacting with code.
- Write more in your GitHub project's README file. Like, write about your working flow, findings, new learned things, useful resources, etc.
Hope you will find this Feedback Helpful.
0 - Instead of using
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