<div class="container">
  <div class="div-to-center">
    <h2>Center me</h2>
    <p>It's a bit difficult without flexbox!</p>
    <img src="https://www.thediygolfer.com/wp-content/uploads/2020/12/putting-1200x800.png" width="200" alt="">
  </div>
</div>
.container {
  height: 100vh;
}

.div-to-center {
  max-width: 250px;
  
  /* Centers horizontally */
  margin: 0 auto; 
  
  /* Following 3 properties center vertically */
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

/*
  Style only properties - these do not affect
  the positioning of the container
*/

.div-to-center {
  padding: 20px;
  border: 1px solid grey;
  border-radius: 5px;
  color: #BFA38A;
  background-color: #1D2326;
}

h2 {
  margin: 0;
}

img {
  border-radius: 5px;
  box-shadow: 1px 2px 3px 1px rgba(0,0,0,0.2);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.