这个问题我经常忘记,所以记录一下 1、水平居中 在css标签中,将text-align属性设置为center,实现文字的水平居中。 2、垂直居中 将line-height属性设置为180px (与height的高度相等),实现文字的垂直居中。