css 如何让文字在图片垂直居中

2025-04-28 04:06:34
推荐回答(1个)
回答1:

设置行高就可以了,行高值是根据你的高度来设的,如果你的高度是20px;那么就设行高line-height:20px;文字就上下居中了;你现在高度是30px那么就设line-height:30px;

.tt{
background-image:url(../images/index-title-rkjd.gif);
line-height:30px;
height:30px;
color : blue;
font-family : Courier New;
font-size : 13pt;

}