.box { display: flex; align-items: center; justify-content: center; } .box div { width: 100px; height: 100px; }