<div class="container">
  <div class="block-element">
    Block element (div) to be vertically centered
  </div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');

:root {
  --const-color-black: #000000;
  --const-color-white: #FFFFFF;
  --color-header: #D9A443;
  --color-main-background: #F9F6F1;
  --color-link: #375F9B;
}

body {
  font-family: 'Open Sans', sans-serif;
  color: var(--const-color-black);
}

* {
  box-sizing: border-box;
}

.container {
  background-color: var(--color-main-background);
  border: 1px solid var(--color-link);
  margin: 1.0rem auto;
  min-height: 200px;
  padding: 1.0rem;
  
  /* Set parent position to relative */
  position: relative;
}

.block-element {
  background-color: var(--color-link);
  color: var(--const-color-white);
  padding: 20px 1.0rem;
  text-align: center;
  
  /* Set child position to absolute */
  position: absolute;
  
  /* Set child to fixed height */
  height: 60px;
  
  /* Set top position to 50% */
  top: 50%;
  
  /* Set margin-top to negative half of height */
  margin-top: -30px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.