.box { width: 100px; height: 100px; margin: 50vh auto 0; <=== this for centering; transform: translateY(-50%); <=== this for centering; background: #000; }