可以使用以下CSS代码实现容器居中:

.container { display: flex; justify-content: center; align-items: center; }

这会使容器在水平和垂直方向上都居中。可以将上述代码应用于你想要居中的容器的父级元素。