1.container {
2 display: flex;
3 justify-content: center;
4 align-items: center;
5}
1/* to make "align-items: center" work: use "min-height: 100vh;"
2100vh = 100% Viewport Height */
3body {
4 display: flex;
5 min-height: 100vh;
6 flex-direction: column;
7 justify-content: center;
8 align-items: center;
9}
1.parent {
2 display: flex;
3 justify-content: center;
4 align-items: center;
5}
1/* For horizontal align: */
2parent-element {text-align:center;}
3/* For horizontal and vertical align: */
4parent-element {position: relative;}
5element-to-be-centered {
6 position: absolute;
7 left: 50%;
8 top: 50%;
9 transform: translate(-50%, -50%);
10}
11
12/* See https://www.w3schools.com/css/css_align.asp for more info */
1body {
2 display:flex; flex-direction:column; justify-content:center;
3 min-height:100vh;
4}