Mahmood• 1,270
@MahmoodHashem
Posted
Hello there.
Congratulations on completing the challenge.
Centering a card using Flexbox is a great way,
Here is another way I recently realized:
- give the body a height of 100vh and use
align-content: center
to center the card vertically, and usemargin: auto
in card to center the card horizontally. You can achieve this with just two properties.
body{
height: 100vh;
align-content: center;
}
.card{
margin:auto
}
Marked as helpful
1
Joe• 30
@YoussefGaafar
Posted
Thank you so much mahmoud for your feedback. I will definitely consider this approach when needed.@MahmoodHashem
1