Submitted over 2 years ago
order summary challenge made by me with html & css
@KarimanMedhat
Design comparison
SolutionDesign
Solution retrospective
I faced a problem with setting the content in the middle of the page so I want to know if there is a way to make it centered?
Community feedback
- @Aya-Saeed261Posted over 2 years ago
You can use flexbox.
parent-of-the-element-to-be-centered { display: flex; justify-content: center; (centers elements horizontally) align-items: center; (centers elements vertically) }
Another solution could be by using the position property.
parent-of-the-element-to-be-centered { position: relative } element-to-be-centered{ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
If it's still not clear, google how to center an element in css and you'll find many videos and articles explaining this.
0@KarimanMedhatPosted over 2 years ago@Aya-Saeed261 I used both ways already and I use them usually when I code any other project but this time they didn't work so I asked if there is another way, but I'm really glad you helped me.
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