vertical-align-flex

center vertically and horizontally a div inside another div using flexbox

by freaktiful

HTML

<div class="div-padre">
  <div class="div-hijo">
    texto centrado
  </div>
</div>

CSS

.div-padre {
  width: 400px;
  height: 400px;
  background: green;
  display: flex;
  justify-content: center;
  align-items: center;
}

.div-hijo {
  background: white;
}