Design comparison
Solution retrospective
I got stuck on the vertical alignment. In this challenge i used margin property to space the div element from top and bottom. I want to know is there any other more good way to achieve that. Second thing i got stuck on was the text, I want to know if that is perfect?
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
- You already using
Flexbox
for layout, but you didn't utilized it's full potential. Just add the following rules to properly center the component.
.nav-wrapper { min-height: 100vh; align-items: center; }
- Now remove these styles, after removing you can able to see the changes
.nav-wrapper { margin: 10% 0px; }
- Now your component has been properly centered
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
1 - @destanyrPosted over 1 year ago
Hello!
First of all great job completing this challenge! Your design looks fairly spot on so congrats on that.
This is my first time offering advice here, so hopefully I can give you information you can find useful.
The colors are a bit off from what I see. In the style guide provided they give you all the correct colors to use for all the text. That should resolve that issue.
As for the positioning, I actually did the same thing when trying to center the component the first time. There's several ways to get it centered, but here is an example of code that I use to get everything centered directly in the middle in your CSS. My method may be a bit off, but it is successful for me. Other people use CSS grid, but I find I am more comfortable with Flexbox. The dot below is actually an asterisk, but for some reason is only appearing as a bullet point.
-
{
margin: 0;
padding: 0; }
body {
min-height: 100vh; display: flex; justify-content: center; align-items: center;
}
Try putting an image in the html, and putting this code in the CSS and see if it resolves your issue and is positioned how you need.
Hope this helps! Happy coding!
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