A quickest CSS Methods to center div on screen or other div both vertically and horizontally using "display : flex".
CSS Code -
.parent_div{
width: 100%;
height: 500px;
background-color: green;
/* use flex to center child div */
display: flex;
justify-content: center;
align-items: center;
}
.child_div{
width: 250px;
height: 250px;
background-color: blue;
}
#css #howto #webdev #flex #design #csstricks #centeradiv
![](https://s2.save4k.ru/pic/tQZQGFkD35A/mqdefault.jpg)