<div class="container">
  <div class="element">
    This element is centered. No matter how its size changes, it will always be centered horizontally and vertically inside its container.
body {
  background-color: #F5F5F5;
  color: #555;
  font-size: 1.1em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;

.container {
  max-width: 800px;
  margin: 3em auto;
  background-color: white;
  height: 500px;
  border: 10px solid #594255;
  -webkit-display: -webkit-box;
  -webkit-display: -webkit-flex;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-justify-content: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;

.element {
  background-color: #594255;
  color: white;
  width: 250px;
  padding: 20px;