<div> 看你是不是垂直居中的 </div> <span> 如果一个容器中只有一行文字,对它实现居中相对比较简单,我们只需要设置它的实际高度height和所在行的高度line-height相等即可。 </span>
body { font-size: 12px; font-family: tahoma; } div { height: 200px; line-height: 200px; border: 1px solid #FF0099; background-color: #FFCCFF; text-align: center } span { font-size: 21px; color: rgb(255, 0, 0); }