What is the correct way to center 3 divs vertically and horizontally in a div? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the correct way to center 3 divs vertically and horizontally in a div?

What is the correct way to center 3 divs in a div?

22nd Dec 2020, 1:41 PM
Sukhchain Singh
Sukhchain Singh - avatar
2 Answers
22nd Dec 2020, 1:44 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
the container should have the following css values: .container{ width:/*width of container*/ display:flex; align-items:center; justify-content:center; } if you want to vertically align use: flex-direction:column;
22nd Dec 2020, 8:45 PM
Logomonic Learning
Logomonic Learning - avatar