How To Center <div> Vertically?
When I am not able to center a div container...

๐ Hey! I'm Prakash Naikwadi. I have a Bachelor's degree in Computer Engineering๐คฉ
I am currently learning๐ ๐๐๐๐ ๐๐ญ๐๐๐ค ๐๐๐ฏ๐๐ฅ๐จ๐ฉ๐ฆ๐๐ง๐ญ.
๐ ๐๐ข๐ญ๐๐ฎ๐ ๐๐ซ๐จ๐๐ข๐ฅ๐: https://github.com/prakash-naikwadi
๐๐๐ซ๐ ๐๐ซ๐ ๐๐จ๐ฆ๐ ๐ฌ๐ค๐ข๐ฅ๐ฅ๐ฌ๐๐ญ๐ฌ ๐ญ๐ก๐๐ญ ๐ ๐๐จ๐ฌ๐ฌ๐๐ฌ๐ฌ๐๐...
๐
๐ซ๐จ๐ง๐ญ ๐๐ง๐:
โข HTML5 (Intermediate Level)
โข CSS (Intermediate Level)
โข JavaScript
โข React
๐๐ซ๐จ๐ ๐ซ๐๐ฆ๐ฆ๐ข๐ง๐ ๐๐๐ง๐ ๐ฎ๐๐ ๐๐ฌ: โข Java โข C โข C++
Thank you for reading. Have a wonderful day๐ค
Hello๐,
I am learning CSS past 15days now and I am working on some projects where I have to center a whole card component vertically and horizontally in the middle of a page.
I have learned from my previous project How To Center an Element horizontally, I have put the code below(This is in every tutorial you follow):
By Setting left and right margin as auto:


But, When I tried to align vertically by setting the Top & Bottom margin as auto but it did not work ๐ค
Why margin auto does not work: https://www.hongkiat.com/blog/css-margin-auto/ this is a great article to read.
So after hustling through google searches I got to know that this is a common problem every programmer had faced in their CSS journey.
So I came to know that there are a lot of techniques out there for this problem and came across this article:
6 CSS Tricks to Align Content Vertically: https://www.hongkiat.com/blog/css-tricks-vertical-align-content/
I think in this article there is all possible daily occurring vertically aligned content patterns are given.
๐๐ก๐๐ง๐ค ๐๐จ๐ฎ ๐ ๐จ๐ซ ๐๐๐๐๐ข๐ง๐ ๐๐๐ฏ๐ ๐ ๐๐จ๐จ๐ ๐๐๐ฒ ๐




