Home / CSS Tips Generated By ChatGPT / Flexbox for Centering Items Horizontally and Vertically in CSS Use Flexbox to easily center items both horizontally and vertically within a container. Source Code .center-flex { display: flex; justify-content: center; align-items: center; height: 200px; }