how to align div in center vertically code example

Example 1: css center image

.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

Example 2: css align items vertical center

.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}

Example 3: center elements vertically in div

.container {        
    display: flex;
    align-items: center;
}

Example 4: css center vertically

/* 100vh = 100% Viewport Height */
body {
	display: flex;
	height: 100vh;
	flex-direction: column;
	justify-content: center;
}
/* add */ align-items: center; /*to also center horizontally.*/

Example 5: center css elements

body{
  display: grid;
  place-items: center;
}