Edit in JSFiddle

const styles = `
  .parent {
    position: relative;
    width: 100%;
    height: 100%;
  }

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