.parent { display: flex; justify-content: center; align-items: center; } .child { display: inline-block; }