flex layout 3

https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox_skills#flex_layout_three

HTML

<!doctype html>

<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Flexbox: Task 3</title>


    <style>
        body {
            background-color: #fff;
            color: #333;
            font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
            padding: 1em;
            margin: 0;
        }

        .parent {
          border: 2px solid #77A6B6;
          border-radius: .5em;
          width: 400px;
          height: 300px;
        }

        .child {
          background-color: #4D7298; 
          color: #fff;
          padding: .5em;
          width: 150px;
        }
    </style>



</head>

<body>

  <div class="parent">
    <div class="child">Center me.</div>
  </div>

</body>

</html>

CSS

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

.child {
  text-align: center;
}