Design comparison
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 using css layout properties.
- 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 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 - @ecemgoPosted over 1 year ago
Some recommendations regarding your code could be of interest to you.
- Indeed, you don't need media queries for this solution so you can delete the media queries.
- You can remove flexbox from the
.card
because they don't work. - You can add
max-width
to the.card
, so it makes the card responsive.
.card { /* display: flex; */ /* align-items: center; */ /* flex-direction: column; */ max-width: 300px; }
- Then, if you add
width: 100%
,height: 100%
anddisplay: block
to the.card__img
as I suggest, the image will be positioned completely on the card
.card .card__img { border-radius: 10px; /* max-width: 200px; */ /* max-height: 200px; */ width: 100%; height: 100%; display: block; }
Hope I am helpful. :)
0 - @Dinil-ThilakarathnePosted over 1 year ago
Hi!, Congratulations on successfully completing the challenge! π
- Your code is impressive, but I have some valuable recommendations that could take it to the next level.
CSS : π¨
-
Looks like the card component has not been displayed well. So let me explain, How you can easily adjust the component using CSS properties.
-
By setting the height and width of your card component, you can ensure that it maintains its size even when the window is resized.
/* card */ .card{ height: 500px; width: 400px; background-color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-around; border-radius: 20px; }
- You can learn more from π here
- Now your card looks well.
Thank you, I'm glad to hear that my response was helpful! If you have any more questions or need further assistance, feel free to ask.
Dinil Thilakarathne
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