2808 explained code solutions for 75 technologies


cssHow to align a div vertically on the page using flex


.parent-div{
    display: flex;
    height: 100%;
    width: 100%;
    align-items: center;
}ctrl + c
.parent-div

parent element inside of which your aligned div should be

display: flex

set display property to flex

height: 100%

give the parent element some width and height so it'll be bigger than the aligned div

align-items: center

set the vertical alignment to center