Design comparison
Solution retrospective
Hi everyone! In this project, I had problem with centering the desktop version div, plus the centering elements were not working, so I used margin left and right. Any helpful recommendation will be marked as helpful comment. Thanks!
Community feedback
- @MelvinAguilarPosted over 1 year ago
Hello again ๐. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
-
"the centering elements were not working"
-
Why is it not centered vertically? - You haven't set a defined height to the body element, therefore it won't know what the "center" is in order to center the elements vertically.
-
Why is it not centered horizontally? - You haven't used any property that centers the element on the cross-axis.
align-content
property only works on the cross-axis when there are multiple elements of flex items in the flex container. Therefore, it will not center a single flex item vertically or horizontally in a flex container.place-content
is a shorthand property in CSS for bothalign-content
andjustify-content
properties.
result:
body { min-height: 100vh; /* set height to fill the viewport */ display: flex; flex-direction: column; /* place-content: center; */ /* align-content: center; */ align-items: center; /* for horizontal centering */ justify-content: center; /* for vertical centering */ }
-
Link with more information: A Complete Guide to Flexbox
I hope you find it useful! ๐
Happy coding!
Marked as helpful2@Tamana123-2Posted over 1 year ago@MelvinAguilar Hi! Hope your are doing great. First of all thanks for your comment, it worked. I would be more than happy if you could answer my questions, I started studying java script then I am planning to study python, framework... . Do you have any recommendation of how I can go on effectively? Can you share a little part of you journey? How you started? How did you studied? How much you put time on web development? what are some best sites and methods I could use? As a pro programmer what you advise me? Are you working right now? How can I get a job for like 6 or 7 months later? If you don't want to answer does not matter, but you are a cool person who is so great I want to learn from you. Nice time.
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