Jump to Categories

.Cheatsheet

Vertical/center align

With Flexbox

.outside-element {
  display: flex;
  align-items: center;
  justify-content: center;
}

With translate

.element {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

You can also center align..

.element {
  left: 50%;
  position: relative;
  transform: translateX(-50%);
}

Or do both, I use shorthand translate here...

.element {
  left: 50%;
  position: relative;
  top: 50%;
  transform: translate(-50%, -50%);
}