<main>
  <div>
    I'm a block-level element with an unknown height, centered vertically within my parent.
  </div>
</main>
main {
  background: orange;
  height: 300px;
  margin: 20px;
  width: 300px;
  padding: 20px;
  display: table;
}
main div {
  background: black;
  color: white;
  padding: 20px;
  display: table-cell;
  vertical-align: middle;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.