<div class="container">
  <div class="box">
    i am centered vertically and horizontally!
  </div>
</div>
// center horizontally. styles on parent
.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

// --- everything below is just for styling ---

// box styles
// not relevant except to look good
.box {
  height: 100px;
  width: 200px;
  background: #fff;
  padding: 50px;
  border-radius: 10px;
  position: relative;
  text-align: center;
}

// base styles for the overall pen 
// (not relevant except to look good)
body {
  background: #FFC857;
  overflow-x: hidden;
  
  &:before, &:after {
    display: block;
    content: '';
    background: #FF9F4D;
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    z-index: 0;
  }
  
  &:before {
    top: -100px;
    left: -100px;
  }
  
  &:after {
    bottom: -50px;
    right: -50px;
  }
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.